updated etxlink, ctools, colorbox, computed_field

This commit is contained in:
Bachir Soussi Chiadmi 2019-05-13 17:51:14 +02:00
parent 33210e10f2
commit 2ffad14939
309 changed files with 4930 additions and 2655 deletions

View File

@ -6,22 +6,12 @@ https://www.drupal.org/node/1754162
//includes/entity.inc
//see https://www.drupal.org/node/1003788
# Modules :
// link : allow any tld (https://www.drupal.org/node/2299657#comment-11414075) commited in dev
cer
contentadminrelink
// entity_translation_search_api
entityreference
feedback
// field_group
filter_path_alias
// flag_lists
// nodeformcols
// search_api
// search_api_page
// search_api_solr
termreferencetree
?? views
wysiwyg

View File

@ -1,82 +0,0 @@
Current API VERSION: 2.0. See API.txt for more information.
ctools 7.x-1.x-dev
==================
#1008120: "New custom content" shows empty form if custom content panes module is not enabled.
#999302 by troky: Fix jump menu. Apparently this wasn't actually committed the last time it was committed.
#1065976 by tekante and David_Rothstein: Reset plugin static cache during module enable to prevent stale data from harming export ui.
#1016510 by EclipseGC: Make the taxonomy system page functional.
ctools 7.x-1.x-alpha2 (05-Jan-2011)
===================================
#911396 by alex_b: Prevent notices in export UI.
#919768 by mikey_p: Allow url options to be sent to ctools_ajax_command_url().
#358953 by cedarm: Allow term context to return lowercase, spaces to dashes versions of terms.
#931434 by EclipseGc: Argument plugin for node revision ID.
#910656: CTools AJAX sample wizard demo "domesticated" checkbox value not stored.
#922442 by EugenMayer, neclimdul and voxpelli: Make sure ctools_include can handle '' or NULL directory.
#919956 by traviss359: Correct example in wizard advanced help.
#942968: Fix taxonomy term access rule with tag term vocabs.
#840344: node add argument had crufty code causing notices.
#944462 by longhairedgit: Invalid character in regex causes rare notice.
#938778 by dereine: Fix profile content type for D7 updates.
Add detach event to modal close so that wysiwyg can detach the editor.
Variant titles showing up as blank if more than one variant on a page.
#940016: token support was not yet updated for D7.
#940446: Skip validation on back and cancel buttons in all wizards.
#954492: Redirect not always working in wizard.inc
#955348: Lack of redirect on "Update" button in Page Manager causing data loss sometimes.
#941778: Update and save button should not appear in the "Add variant" path.
#955070 by EclipseGc: Update ctools internal page tokens to work properly on content all content.
#956890 by EclipseGc: Update views_content to not use views dependency since that is gone.
#954728 by EclipseGc: Update node template page function name to not collide with new hook_node_view().
#946534 by EclipseGc: Add support for field content on all entitities.
#952586 by EclipseGc: Fix node_author content type.
#959206: If a context is not set when rendering content, attempt to guess the context (fixes Views panes where "From context" was added but pane was never edited.)
#961654 by benshell: drupal_alter() only supports 4 arguments.
#911362 by alex_b: Facilitate plugin cache resets for tests.
#945360 by naxoc: node_tag_new() not updated to D7.
#953804 by EclipseGc: Fix node comment rendering.
#953542 by EclipseGc: Fix node rendering.
#953776 by EclipseGc: Fix node link rendering.
#954772 by EclipseGc: Fix node build mode selection in node content type.
#954762 by EclipseGc: Fix comment forbidden theme call.
#954894 by EclipseGc: Fix breadcrumb content type.
#955180 by EclipseGc: Fix page primary navigation type.
#957190 by EclipseGc: Fix page secondary navigation type.
#957194 by EclipseGc: Remove mission content type, since D7 no longer has a site mission.
#957348 by EclipseGc: Fix search form URL path.
#952586 by andypost: Use format_username for displaying unlinked usernames.
#963800 by benshell: Fix query to fetch custom block title.
#983496 by Amitaibu: Fix term argument to use proper load function.
#989484 by Amitaibu: Fix notice in views plugin.
#982496: Fix token context.
#995026: Fix export UI during enable/disable which would throw notices and not properly set/unset menu items.
#998870 by Amitaibu: Fix notice when content has no icon by using function already designed for that.
#983576 by Amitaibu: Node view fallback task showed white screen.
#1004644 by pillarsdotnet: Update a missed theme() call to D7.
#1006162 by aspilicious: .info file cleanup.
#998312 by dereine: Support the expanded/hidden options that Views did for dependent.js
#955030: Remove no longer supported footer message content type.
Fix broken query in term context config.
#992022 by pcambra: Fix node autocomplete.
#946302 by BerdArt and arywyr: Fix PHP 5.3 reference error.
#980528 by das-peter: Notice fix with entity settings.
#999302 by troky: ctools_jump_menu() needed updating to new form parameters.
#964174: stylizer plugin theme delegation was in the wrong place, causing errors.
#991658 by burlap: Fully load the "user" context for the logged in user because not all fields are in $user.
#1014866 by das-peter: Smarter title panes, notice fix on access plugin descriptions.
#1015662 by troky: plugin .info files were not using correct filepaths.
#941780 by EclipseGc: Restore the "No blocks" functionality.
#951048 by EclipseGc: Tighter entity integration so that new entities are automatic contexts and relationships.
#941800 by me and aspilicious: Use Drupal 7 #machine_name automation on page manager pages and all export_ui defaults.
Disabled exportables and pages not properly greyed out.
#969208 by me and benshell: Get user_view and user profile working.
#941796: Recategorize blocks
ctools 7.x-1.x-alpha1
=====================
Changelog reset for 7.x
Basic conversion done during sprint.

View File

@ -60,4 +60,4 @@ Upgrading from ctools-6.x-1.x to ctools-7.x-2.x:
For all of these forms, the separate settings #trees in the form are now
gone, so form ids may be adjusted. Also, these are now all real forms
using CTools form wizard instead of fake subforms as previously.
using CTools form wizard instead of fake subforms as previously.

View File

@ -3,12 +3,9 @@ description = Performs bulk exporting of data objects known about by Chaos tools
core = 7.x
dependencies[] = ctools
package = Chaos tool suite
version = CTOOLS_MODULE_VERSION
; Information added by Drupal.org packaging script on 2016-11-22
version = "7.x-1.12"
; Information added by Drupal.org packaging script on 2019-02-08
version = "7.x-1.15"
core = "7.x"
project = "ctools"
datestamp = "1479787162"
datestamp = "1549603691"

View File

@ -137,7 +137,7 @@ function bulk_export_export($cli = FALSE, $options = array()) {
// Add hook_ctools_plugin_api at the top of the module code, if there is any.
if ($api_code) {
foreach ($api_code as $api_hook => $text) {
$api = "\n/**\n";
$api = "\n/**\n";
$api .= " * Implements hook_$api_hook().\n";
$api .= " */\n";
$api .= "function {$module_name}_$api_hook(\$module, \$api) {\n";
@ -148,7 +148,7 @@ function bulk_export_export($cli = FALSE, $options = array()) {
}
if ($module_code) {
$module = "<?php\n\n";
$module = "<?php\n\n";
$module .= "/**\n";
$module .= " * @file\n";
$module .= " * Bulk export of objects generated by Bulk export module.\n";
@ -193,7 +193,6 @@ function bulk_export_export($cli = FALSE, $options = array()) {
/**
* FAPI definition for the bulk exporter form.
*
*/
function bulk_export_export_form($form, &$form_state) {

View File

@ -1,4 +1,3 @@
.ctools-button-processed {
border-style: solid;
border-width: 1px;
@ -17,8 +16,7 @@
.ctools-no-js .ctools-content ul,
.ctools-button-processed .ctools-content ul {
list-style-image: none;
list-style-type: none;
list-style: none none;
margin-left: 0;
}

View File

@ -1,12 +1,9 @@
.ctools-collapsible-container .ctools-toggle {
float: left;
width: 21px;
height: 21px;
cursor: pointer;
background-position: 7px 7px;
background-repeat: no-repeat;
background-image: url(../images/collapsible-expanded.png);
background: url(../images/collapsible-expanded.png) no-repeat 7px 7px;
}
.ctools-collapsible-container .ctools-collapsible-handle {

View File

@ -5,8 +5,8 @@
}
.ctools-owns-lock {
background: #FFFFDD none repeat scroll 0 0;
border: 1px solid #F0C020;
background: #ffffdd none repeat scroll 0 0;
border: 1px solid #f0c020;
padding: 1em;
}

View File

@ -1,4 +1,3 @@
.ctools-dropbutton-processed {
padding-right: 18px;
position: relative;
@ -20,7 +19,6 @@
height: auto;
position: absolute;
right: 0;
text-indent: -9999px; /* LTR */
top: 0;
width: 17px;
}
@ -51,6 +49,7 @@
right: 6px;
position: absolute;
top: 0.75em;
white-space: nowrap;
}
.ctools-dropbutton-processed.open .ctools-twisty {

View File

@ -49,14 +49,14 @@ html.js div.ctools-dropdown div.ctools-dropdown-container {
html.js div.ctools-dropdown div.ctools-dropdown-container ul li li a {
padding-left: 25px;
width: 150px;
color: #027AC6;
color: #027ac6;
}
html.js div.ctools-dropdown div.ctools-dropdown-container ul li a {
text-decoration: none;
padding-left: 5px;
width: 170px;
color: #027AC6;
color: #027ac6;
}
html.js div.ctools-dropdown div.ctools-dropdown-container ul li span {
@ -69,5 +69,5 @@ html.js div.ctools-dropdown div.ctools-dropdown-container ul li span.text {
}
html.js .ctools-dropdown-hover {
background-color: #ECECEC;
background-color: #ececec;
}

View File

@ -79,7 +79,7 @@ div.ctools-modal-content .no-float .form-item * {
float: none;
}
div.ctools-modal-content .modal-form .no-float label {
div.ctools-modal-content .modal-form .no-float label {
width: auto;
}

View File

@ -1,4 +1,3 @@
/* Farbtastic placement */
.color-form {
max-width: 50em;
@ -32,7 +31,8 @@
clear: left; /* LTR */
width: 14em;
}
.color-form .form-text, .color-form .form-select {
.color-form .form-text,
.color-form .form-select {
float: left; /* LTR */
}
.color-form .form-text {
@ -84,7 +84,7 @@
cursor: default;
}
.ctools-style-icons .form-item {
.ctools-style-icons .form-item {
width: 100px;
float: left;
margin: 0 3px !important;

View File

@ -1,4 +1,3 @@
.wizard-trail {
font-size: 120%;
}

View File

@ -17,9 +17,9 @@
* Inform CTools about plugin types.
*
* @return array
* An array of plugin types, keyed by the type name.
* See the advanced help topic 'plugins-creating' for details of the array
* properties.
* An array of plugin types, keyed by the type name.
* See the advanced help topic 'plugins-creating' for details of the array
* properties.
*/
function hook_ctools_plugin_type() {
$plugins['my_type'] = array(
@ -65,6 +65,7 @@ function hook_ctools_plugin_type() {
* directory location is being requested.
* @param string $plugin_type
* The name of the plugin type for which a base directory is being requested.
*
* @return string
* The path where CTools' plugin system should search for plugin files,
* relative to your module's root. Omit leading and trailing slashes.
@ -94,7 +95,7 @@ function hook_ctools_plugin_directory($owner, $plugin_type) {
// Yes, this is exactly like Form 2 - just a different reasoning for it.
return "plugins/$plugin_type";
}
// Finally, if nothing matches, it's safe to return nothing at all (or NULL).
// Finally, if nothing matches, it's safe to return nothing at all (== NULL).
}
/**
@ -155,7 +156,7 @@ function hook_ctools_api_hook_alter(&$list) {
* allow to use it in the math expression api.
*
* @param $functions
* An array which has the functions as value.
* An array which has the functions as value.
*/
function hook_ctools_math_expression_functions_alter(&$functions) {
// Allow to convert from degrees to radiant.
@ -200,7 +201,10 @@ function hook_ctools_render_alter(&$info, &$page, &$context) {
*/
function hook_ctools_content_subtype_alter($subtype, $plugin) {
// Force a particular subtype of a particular plugin to render last.
if ($plugin['module'] == 'some_plugin_module' && $plugin['name'] == 'some_plugin_name' && $subtype['subtype_id'] == 'my_subtype_id') {
if ($plugin['module'] === 'some_plugin_module'
&& $plugin['name'] === 'some_plugin_name'
&& $subtype['subtype_id'] === 'my_subtype_id'
) {
$subtype['render last'] = TRUE;
}
}
@ -228,6 +232,28 @@ function hook_ctools_entity_context_alter(&$plugin, &$entity, $plugin_id) {
}
}
/**
* Alter the conversion of context items by ctools context plugin convert()s.
*
* @param ctools_context $context
* The current context plugin object. If this implemented a 'convert'
* function, the value passed in has been processed by that function.
* @param string $converter
* A string associated with the plugin type, identifying the operation.
* @param string $value
* The value being converted; this is the only return from the function.
* @param $converter_options
* Array of key-value pairs to pass to a converter function from higher
* levels.
*
* @see ctools_context_convert_context()
*/
function hook_ctools_context_converter_alter($context, $converter, &$value, $converter_options) {
if ($converter === 'mystring') {
$value = 'fixed';
}
}
/**
* Alter the definition of entity context plugins.
*
@ -266,6 +292,22 @@ function hook_ctools_cleanstring_CLEAN_ID_alter(&$settings) {
$settings['lower case'] = TRUE;
}
/**
* Let other modules modify the context handler before it is rendered.
*
* @param object $handler
* A handler for a current task and subtask.
* @param array $contexts
* An associative array of contexts.
* @param array $args
* An array for current args.
*
* @see ctools_context_handler_pre_render()
*/
function ctools_context_handler_pre_render($handler, $contexts, $args) {
$handler->conf['css_id'] = 'my-id';
}
/**
* @} End of "addtogroup hooks".
*/

View File

@ -12,13 +12,15 @@ files[] = tests/context.test
files[] = tests/css.test
files[] = tests/css_cache.test
files[] = tests/ctools.plugins.test
files[] = tests/ctools.test
files[] = tests/math_expression.test
files[] = tests/math_expression_stack.test
files[] = tests/object_cache.test
files[] = tests/object_cache_unit.test
files[] = tests/page_tokens.test
; Information added by Drupal.org packaging script on 2016-11-22
version = "7.x-1.12"
; Information added by Drupal.org packaging script on 2019-02-08
version = "7.x-1.15"
core = "7.x"
project = "ctools"
datestamp = "1479787162"
datestamp = "1549603691"

View File

@ -12,24 +12,25 @@
function ctools_requirements($phase) {
$requirements = array();
if ($phase == 'runtime') {
$t = get_t();
$requirements['ctools_css_cache'] = array(
'title' => t('CTools CSS Cache'),
'title' => $t('CTools CSS Cache'),
'severity' => REQUIREMENT_OK,
'value' => t('Exists'),
'value' => $t('Exists'),
);
$path = 'public://ctools/css';
if (!file_prepare_directory($path, FILE_CREATE_DIRECTORY)) {
$requirements['ctools_css_cache']['description'] = t('The CTools CSS cache directory, %path could not be created due to a misconfigured files directory. Please ensure that the files directory is correctly configured and that the webserver has permission to create directories.', array('%path' => file_uri_target($path)));
$requirements['ctools_css_cache']['description'] = $t('The CTools CSS cache directory, %path could not be created due to a misconfigured files directory. Please ensure that the files directory is correctly configured and that the webserver has permission to create directories.', array('%path' => file_uri_target($path)));
$requirements['ctools_css_cache']['severity'] = REQUIREMENT_ERROR;
$requirements['ctools_css_cache']['value'] = t('Unable to create');
$requirements['ctools_css_cache']['value'] = $t('Unable to create');
}
if (!function_exists('error_get_last')) {
$requirements['ctools_php_52']['title'] = t('CTools PHP requirements');
$requirements['ctools_php_52']['description'] = t('CTools requires certain features only available in PHP 5.2.0 or higher.');
$requirements['ctools_php_52']['title'] = $t('CTools PHP requirements');
$requirements['ctools_php_52']['description'] = $t('CTools requires certain features only available in PHP 5.2.0 or higher.');
$requirements['ctools_php_52']['severity'] = REQUIREMENT_WARNING;
$requirements['ctools_php_52']['value'] = t('PHP !version', array('!version' => phpversion()));
$requirements['ctools_php_52']['value'] = $t('PHP !version', array('!version' => phpversion()));
}
}
@ -40,7 +41,19 @@ function ctools_requirements($phase) {
* Implements hook_schema().
*/
function ctools_schema() {
return ctools_schema_3();
return ctools_schema_4();
}
/**
* Version 4 of the CTools schema.
*/
function ctools_schema_4() {
$schema = ctools_schema_3();
// Removed due to alternative database configuration issues.
// @see https://www.drupal.org/project/ctools/issues/2941920
return $schema;
}
/**
@ -49,7 +62,7 @@ function ctools_schema() {
function ctools_schema_3() {
$schema = ctools_schema_2();
// update the 'obj' field to be 128 bytes long:
// Update the 'obj' field to be 128 bytes long:
$schema['ctools_object_cache']['fields']['obj']['length'] = 128;
return $schema;
@ -61,7 +74,7 @@ function ctools_schema_3() {
function ctools_schema_2() {
$schema = ctools_schema_1();
// update the 'name' field to be 128 bytes long:
// Update the 'name' field to be 128 bytes long:
$schema['ctools_object_cache']['fields']['name']['length'] = 128;
// Update the 'data' field to be type 'blob'.
@ -95,10 +108,10 @@ function ctools_schema_2() {
'serialize' => TRUE,
),
'filter' => array(
'type' => 'int',
'size' => 'tiny',
'description' => 'Whether or not this CSS needs to be filtered.',
),
'type' => 'int',
'size' => 'tiny',
'description' => 'Whether or not this CSS needs to be filtered.',
),
),
'primary key' => array('cid'),
);
@ -197,7 +210,7 @@ function ctools_update_6003() {
if ($result) {
db_delete('system')->condition('name', 'panels_views')->execute();
module_enable(array('views_content'), TRUE);
}
}
}
/**
@ -216,7 +229,7 @@ function ctools_update_6005() {
}
/**
* ctools_custom_content table was originally here, but is now moved to
* The ctools_custom_content table was originally here, but is now moved to
* its own module.
*/
function ctools_update_6007() {
@ -230,18 +243,18 @@ function ctools_update_6007() {
}
/**
* ctools_object_cache needs to be defined as a blob.
* The ctools_object_cache needs to be defined as a blob.
*/
function ctools_update_6008() {
db_delete('ctools_object_cache')
->execute();
db_change_field('ctools_object_cache', 'data', 'data', array(
'type' => 'blob',
'size' => 'big',
'description' => 'Serialized data being stored.',
'serialize' => TRUE,
)
'type' => 'blob',
'size' => 'big',
'description' => 'Serialized data being stored.',
'serialize' => TRUE,
)
);
}
@ -263,3 +276,24 @@ function ctools_update_7001() {
'description' => 'The type of the object this cache is attached to; this essentially represents the owner so that several sub-systems can use this cache.',
));
}
/**
* Increase the length of the ctools_object_cache.name column to 255.
*/
function ctools_update_7002() {
// Removed due to alternative database configuration issues.
// @see https://www.drupal.org/project/ctools/issues/2941920
}
/**
* Revert the length of the ctools_object_cache.name column back to 128.
*/
function ctools_update_7003() {
db_delete('ctools_object_cache')->execute();
db_change_field('ctools_object_cache', 'name', 'name', array(
'type' => 'varchar',
'length' => '128',
'not null' => TRUE,
'description' => 'The name of the object this cache is attached to.',
));
}

View File

@ -22,8 +22,11 @@ define('CTOOLS_API_VERSION', '2.0.9');
* simply include a dependency line in that module's info file, e.g.:
* ; Requires CTools v7.x-1.4 or newer.
* dependencies[] = ctools (>=1.4)
*
* @deprecated in CTools 1.15 and will be removed before CTools 2.0.0.
* Use the version provided by the drupal.org packaging system.
*/
define('CTOOLS_MODULE_VERSION', '7.x-1.11');
define('CTOOLS_MODULE_VERSION', '7.x-1.13');
/**
* Test the CTools API version.
@ -75,6 +78,9 @@ define('CTOOLS_MODULE_VERSION', '7.x-1.11');
* The minimum version of CTools necessary for your software to run with it.
* @param $maximum
* The maximum version of CTools allowed for your software to run with it.
*
* @return bool
* TRUE if the running ctools is usable, FALSE otherwise.
*/
function ctools_api_version($minimum, $maximum = NULL) {
if (version_compare(CTOOLS_API_VERSION, $minimum, '<')) {
@ -89,8 +95,7 @@ function ctools_api_version($minimum, $maximum = NULL) {
}
// -----------------------------------------------------------------------
// General utility functions
// General utility functions.
/**
* Include .inc files as necessary.
*
@ -118,6 +123,7 @@ function ctools_api_version($minimum, $maximum = NULL) {
* @param $dir
* Optional subdirectory containing the include file.
*/
function ctools_include($file, $module = 'ctools', $dir = 'includes') {
static $used = array();
@ -147,8 +153,8 @@ function ctools_form_include(&$form_state, $file, $module = 'ctools', $dir = 'in
/**
* Add an arbitrary path to the $form_state so it can work with form cache.
*
* module_load_include uses an unfortunately annoying syntax to work, making it
* difficult to translate the more simple $path + $file syntax.
* The module_load_include() function uses an unfortunately annoying syntax to
* work, making it difficult to translate the more simple $path + $file syntax.
*/
function ctools_form_include_file(&$form_state, $filename) {
if (!isset($form_state['build_info']['args'])) {
@ -172,6 +178,9 @@ function ctools_form_include_file(&$form_state, $filename) {
* Optional module containing the include.
* @param $dir
* Optional subdirectory containing the include file.
*
* @return string
* A string containing the appropriate path from drupal root.
*/
function ctools_image_path($image, $module = 'ctools', $dir = 'images') {
return drupal_get_path('module', $module) . "/$dir/" . $image;
@ -211,6 +220,9 @@ function ctools_add_css($file, $module = 'ctools', $dir = 'css') {
* Optional module containing the include.
* @param $dir
* Optional subdirectory containing the include file.
*
* @return string
* A string containing the appropriate path from drupal root.
*/
function ctools_attach_css($file, $module = 'ctools', $dir = 'css') {
return drupal_get_path('module', $module) . "/$dir/$file.css";
@ -249,6 +261,9 @@ function ctools_add_js($file, $module = 'ctools', $dir = 'js') {
* Optional module containing the include.
* @param $dir
* Optional subdirectory containing the include file.
*
* @return string
* A string containing the appropriate path from drupal root.
*/
function ctools_attach_js($file, $module = 'ctools', $dir = 'js') {
return drupal_get_path('module', $module) . "/$dir/$file.js";
@ -267,16 +282,29 @@ function ctools_get_roles() {
return user_roles();
}
/*
* Break x,y,z and x+y+z into an array. Numeric only.
/**
* Parse integer sequences of the form "x,y,z" or "x+y+z" into separate values.
*
* A string with integers separated by comma (,) is reported as an 'and' set;
* separation by a plus sign (+) or a space ( ) is an 'or' set. The meaning
* of this is up to the caller. Negative or fractional numbers are not
* recognised.
*
* Additional space characters within or around the sequence are not allowed.
*
* @param $str
* The string to parse.
*
* @return $object
* An object containing
* - operator: Either 'and' or 'or'
* - value: An array of numeric values.
* @return object
* An object containing the properties:
*
* - operator: Either 'and' or 'or' when there are multiple matched values.
* Absent when invalid_input is TRUE or there is only one value.
* - value: An array of integers (never strings) from $str. An empty array is
* returned if the input is empty. A single integer input is returned
* as a single value, but no 'operator' is defined.
* - invalid_input: TRUE if input could not be parsed and the values array
* will contain just -1. This property is otherwise absent.
*/
function ctools_break_phrase($str) {
$object = new stdClass();
@ -286,7 +314,7 @@ function ctools_break_phrase($str) {
$object->operator = 'or';
$object->value = preg_split('/[+ ]/', $str);
}
else if (preg_match('/^([0-9]+,)*[0-9]+$/', $str)) {
elseif (preg_match('/^([0-9]+,)*[0-9]+$/', $str)) {
$object->operator = 'and';
$object->value = explode(',', $str);
}
@ -304,7 +332,7 @@ function ctools_break_phrase($str) {
// Doubly ensure that all values are numeric only.
foreach ($object->value as $id => $value) {
$object->value[$id] = intval($value);
$object->value[$id] = (int) $value;
}
return $object;
@ -314,23 +342,29 @@ function ctools_break_phrase($str) {
* Set a token/value pair to be replaced later in the request, specifically in
* ctools_page_token_processing().
*
* @param $token
* @param string $token
* The token to be replaced later, during page rendering. This should
* ideally be a string inside of an HTML comment, so that if there is
* no replacement, the token will not render on the page.
* @param $type
* ideally be a string inside of an HTML comment, so that if there is
* no replacement, the token will not render on the page.
* If $token is NULL, the token set is not changed, but is still
* returned.
* @param string $type
* The type of the token. Can be either 'variable', which will pull data
* directly from the page variables
* @param $argument
* If $type == 'variable' then argument should be the key to fetch from
* the $variables. If $type == 'callback' then it should either be the
* callback, or an array that will be sent to call_user_func_array().
* directly from the page variables, or 'callback', which causes a function
* to be called to calculate the value. No other values are supported.
* @param string|array $argument
* For $type of:
* - 'variable': argument should be the key to fetch from the $variables.
* - 'callback': then it should either be the callback function name as a
* string, or an array that will be sent to call_user_func_array(). Argument
* arrays must not use array keys (i.e. $a[0] is the first and $a[1] the
* second element, etc.)
*
* @return
* @return array
* A array of token/variable names to be replaced.
*/
function ctools_set_page_token($token = NULL, $type = NULL, $argument = NULL) {
static $tokens = array();
$tokens = &drupal_static('ctools_set_page_token', array());
if (isset($token)) {
$tokens[$token] = array($type, $argument);
@ -339,13 +373,32 @@ function ctools_set_page_token($token = NULL, $type = NULL, $argument = NULL) {
}
/**
* Easily set a token from the page variables.
* Reset the defined page tokens within this request.
*
* Introduced for simpletest purposes. Normally not needed.
*/
function ctools_reset_page_tokens() {
drupal_static_reset('ctools_set_page_token');
}
/**
* Set a replacement token from the containing element's children during #post_render.
*
* This function can be used like this:
* $token = ctools_set_variable_token('tabs');
* $token = ctools_set_variable_token('tabs');
*
* $token will then be a simple replacement for the 'tabs' about of the
* variables available in the page template.
* The token "<!-- ctools-page-tabs -->" would then be replaced by the value of
* this element's (sibling) render array key 'tabs' during post-render (or be
* deleted if there was no such key by that point).
*
* @param string $token
* The token string for the page callback, e.g. 'title'.
*
* @return string
* The constructed token.
*
* @see ctools_set_callback_token()
* @see ctools_page_token_processing()
*/
function ctools_set_variable_token($token) {
$string = '<!-- ctools-page-' . $token . ' -->';
@ -354,10 +407,45 @@ function ctools_set_variable_token($token) {
}
/**
* Easily set a token from the page variables.
* Set a replacement token from the value of a function during #post_render.
*
* This function can be used like this:
* $token = ctools_set_variable_token('id', 'mymodule_myfunction');
* $token = ctools_set_callback_token('id', 'mymodule_myfunction');
*
* Or this (from its use in ctools_page_title_content_type_render):
* $token = ctools_set_callback_token('title', array(
* 'ctools_page_title_content_type_token', $conf['markup'], $conf['id'], $conf['class']
* )
* );
*
* The token (e.g: "<!-- ctools-page-id-1b7f84d1c8851290cc342631ac663053 -->")
* would then be replaced during post-render by the return value of:
*
* ctools_page_title_content_type_token($value_markup, $value_id, $value_class);
*
* @param string $token
* The token string for the page callback, e.g. 'title'.
*
* @param string|array $callback
* For callback functions that require no args, the name of the function as a
* string; otherwise an array of two or more elements: the function name
* followed by one or more function arguments.
*
* NB: the value of $callback must be a procedural (non-class) function that
* passes the php function_exists() check.
*
* The callback function itself will be called with args dependent
* on $callback. If:
* - $callback is a string, the function is called with a reference to the
* render array;
* - $callback is an array, the function is called with $callback merged
* with an array containing a reference to the render array.
*
* @return string
* The constructed token.
*
* @see ctools_set_variable_token()
* @see ctools_page_token_processing()
*/
function ctools_set_callback_token($token, $callback) {
// If the callback uses arguments they are considered in the token.
@ -384,9 +472,9 @@ function ctools_set_no_blocks($blocks = FALSE) {
/**
* Wrapper function to create UUIDs via ctools, falls back on UUID module
* if it is enabled. This code is a copy of uuid.inc from the uuid module.
*
* @see http://php.net/uniqid#65879
*/
function ctools_uuid_generate() {
if (!module_exists('uuid')) {
ctools_include('uuid');
@ -413,6 +501,7 @@ function ctools_uuid_generate() {
/**
* Check that a string appears to be in the format of a UUID.
*
* @see http://drupal.org/project/uuid
*
* @param $uuid
@ -468,6 +557,8 @@ function ctools_class_add($classes, $hook = 'html') {
*/
function ctools_class_remove($classes, $hook = 'html') {
if (!is_array($classes)) {
// @todo Consider using explode(' ', $classes);
// @todo Consider checking that $classes is a string before adding.
$classes = array($classes);
}
@ -480,12 +571,35 @@ function ctools_class_remove($classes, $hook = 'html') {
}
}
// -----------------------------------------------------------------------
// Drupal core hooks
/**
* Reset the storage used for ctools_class_add and ctools_class_remove.
*
* @see ctools_class_add()
* @see ctools_class_remove()
*/
function ctools_class_reset() {
drupal_static_reset('ctools_process_classes');
}
/**
* Return the classes for the body (added by ctools_class_add).
*
* @return array
* A copy of the array of classes to add to the body tag. If none have been
* added, this will be an empty array.
*
* @see ctools_class_add()
*/
function ctools_get_classes() {
return drupal_static('ctools_process_classes', array());
}
// -----------------------------------------------------------------------
// Drupal core hooks.
/**
* Implement hook_init to keep our global CSS at the ready.
*/
function ctools_init() {
ctools_add_css('ctools');
// If we are sure that CTools' AJAX is in use, change the error handling.
@ -504,7 +618,7 @@ function ctools_init() {
* Shutdown handler used during ajax operations to help catch fatal errors.
*/
function ctools_shutdown_handler() {
if (function_exists('error_get_last') AND ($error = error_get_last())) {
if (function_exists('error_get_last') && ($error = error_get_last())) {
switch ($error['type']) {
case E_ERROR:
case E_CORE_ERROR:
@ -583,7 +697,6 @@ function ctools_flush_caches() {
/**
* Implements hook_element_info_alter().
*
*/
function ctools_element_info_alter(&$type) {
ctools_include('dependent');
@ -619,10 +732,10 @@ function ctools_registry_files_alter(&$files, $indexed_modules) {
// -----------------------------------------------------------------------
// FAPI hooks that must be in the .module file.
/**
* Alter the comment form to get a little more control over it.
*/
function ctools_form_comment_form_alter(&$form, &$form_state) {
if (!empty($form_state['ctools comment alter'])) {
// Force the form to post back to wherever we are.
@ -640,11 +753,11 @@ function ctools_node_comment_form_submit(&$form, &$form_state) {
// -----------------------------------------------------------------------
// CTools hook implementations.
/**
* Implementation of hook_ctools_plugin_directory() to let the system know
* where all our own plugins are.
*/
function ctools_ctools_plugin_directory($owner, $plugin_type) {
if ($owner == 'ctools') {
return 'plugins/' . $plugin_type;
@ -665,11 +778,11 @@ function ctools_ctools_plugin_type() {
// -----------------------------------------------------------------------
// Drupal theme preprocess hooks that must be in the .module file.
/**
* A theme preprocess function to automatically allow panels-based node
* templates based upon input when the panel was configured.
*/
function ctools_preprocess_node(&$vars) {
// The 'ctools_template_identifier' attribute of the node is added when the pane is
// rendered.
@ -679,14 +792,13 @@ function ctools_preprocess_node(&$vars) {
}
}
/**
* Implements hook_page_alter().
*
* Last ditch attempt to remove sidebar regions if the "no blocks"
* functionality has been activated.
*
* @see ctools_block_list_alter().
* @see ctools_block_list_alter()
*/
function ctools_page_alter(&$page) {
$check = drupal_static('ctools_set_no_blocks', TRUE);
@ -716,6 +828,7 @@ function ctools_page_token_processing($children, $elements) {
case 'variable':
$tokens[$token] = isset($elements[$argument]) ? $elements[$argument] : '';
break;
case 'callback':
if (is_string($argument) && function_exists($argument)) {
$tokens[$token] = $argument($elements);
@ -744,7 +857,7 @@ function ctools_process(&$variables, $hook) {
return;
}
$classes = drupal_static('ctools_process_classes', array());
$classes = ctools_get_classes();
// Process the classses to add.
if (!empty($classes[$hook]['add'])) {
@ -758,12 +871,6 @@ function ctools_process(&$variables, $hook) {
$variables['classes_array'] = array_diff($variables['classes_array'], $remove_classes);
}
// Update the classes within the attributes array to match the classes array
if (isset($variables['attributes_array']['class'])) {
$variables['attributes_array']['class'] = array_unique(array_merge($variables['classes_array'], $variables['attributes_array']['class']));
$variables['attributes'] = $variables['attributes_array'] ? drupal_attributes($variables['attributes_array']) : '';
}
// Since this runs after template_process(), we need to re-implode the
// classes array.
$variables['classes'] = implode(' ', $variables['classes_array']);
@ -771,7 +878,6 @@ function ctools_process(&$variables, $hook) {
// -----------------------------------------------------------------------
// Menu callbacks that must be in the .module file.
/**
* Determine if the current user has access via a plugin.
*
@ -795,6 +901,7 @@ function ctools_process(&$variables, $hook) {
* @return
* TRUE if access is granted, false if otherwise.
*/
function ctools_access_menu($access) {
// Short circuit everything if there are no access tests.
if (empty($access['plugins'])) {
@ -823,7 +930,7 @@ function ctools_access_menu($access) {
* An indexed array of zero or more permission strings to be checked by
* user_access().
*
* @return
* @return bool
* Iff all checks pass will this function return TRUE. If an invalid argument
* is passed (e.g., not a string), this function errs on the safe said and
* returns FALSE.
@ -885,7 +992,6 @@ function ctools_export_ui_load($item_name, $plugin_name) {
// -----------------------------------------------------------------------
// Caching callbacks on behalf of export-ui.
/**
* Menu access callback for various tasks of export-ui.
*/
@ -929,7 +1035,7 @@ function ctools_export_ui_ctools_access_get($argument) {
}
/**
* Callback for access control ajax form on behalf of export ui
* Callback for access control ajax form on behalf of export ui.
*
* Returns the cached access config and contexts used.
* Note that this is assuming that access will be in $item->access -- if it
@ -962,8 +1068,9 @@ function ctools_menu_local_tasks_alter(&$data, $router_item, $root_path) {
}
/**
* Implement hook_block_list_alter() to potentially remove blocks.
* Implements hook_block_list_alter().
*
* Used to potentially remove blocks.
* This exists in order to replicate Drupal 6's "no blocks" functionality.
*/
function ctools_block_list_alter(&$blocks) {
@ -1026,6 +1133,7 @@ function ctools_ctools_entity_context_alter(&$plugin, &$entity, $plugin_id) {
case 'entity_id:taxonomy_term':
$plugin['no ui'] = TRUE;
break;
case 'entity:user':
$plugin = ctools_get_context('user');
unset($plugin['no ui']);
@ -1059,18 +1167,21 @@ function ctools_field_create_field($field) {
function ctools_field_create_instance($instance) {
ctools_flush_field_caches();
}
/**
* Implements hook_field_delete_field().
*/
function ctools_field_delete_field($field) {
ctools_flush_field_caches();
}
/**
* Implements hook_field_delete_instance().
*/
function ctools_field_delete_instance($instance) {
ctools_flush_field_caches();
}
/**
* Implements hook_field_update_field().
*/

View File

@ -2,12 +2,10 @@ name = Custom rulesets
description = Create custom, exportable, reusable access rulesets for applications like Panels.
core = 7.x
package = Chaos tool suite
version = CTOOLS_MODULE_VERSION
dependencies[] = ctools
; Information added by Drupal.org packaging script on 2016-11-22
version = "7.x-1.12"
; Information added by Drupal.org packaging script on 2019-02-08
version = "7.x-1.15"
core = "7.x"
project = "ctools"
datestamp = "1479787162"
datestamp = "1549603691"

View File

@ -1,5 +1,9 @@
<?php
/**
* @file
*/
/**
* Schema for customizable access rulesets.
*/

View File

@ -2,7 +2,7 @@
/**
* @file
* ctools_access_ruleset module
* The ctools_access_ruleset module.
*
* This module allows styles to be created and managed on behalf of modules
* that implement styles.
@ -30,7 +30,7 @@ function ctools_access_ruleset_permission() {
*/
function ctools_access_ruleset_ctools_plugin_directory($module, $plugin) {
// Most of this module is implemented as an export ui plugin, and the
// rest is in ctools/includes/ctools_access_ruleset.inc
// rest is in ctools/includes/ctools_access_ruleset.inc.
if ($module == 'ctools' && ($plugin == 'export_ui' || $plugin == 'access')) {
return 'plugins/' . $plugin;
}
@ -47,7 +47,7 @@ function ctools_access_ruleset_panels_dashboard_blocks(&$vars) {
'description' => t('Custom rulesets are combinations of access plugins you can use for access control, selection criteria and pane visibility.'),
);
// Load all mini panels and their displays.
// Load all mini panels and their displays.
ctools_include('export');
$items = ctools_export_crud_load_all('ctools_access_ruleset');
$count = 0;

View File

@ -35,7 +35,7 @@ function ctools_ruleset_ctools_access_merge_plugin($plugin, $parent, $item) {
$plugin['required context'] = array();
foreach ($item->requiredcontexts as $context) {
$info = ctools_get_context($context['name']);
// TODO: allow an optional setting
// TODO: allow an optional setting.
$plugin['required context'][] = new ctools_context_required($context['identifier'], $info['context name']);
}
}
@ -72,7 +72,7 @@ function ctools_ruleset_ctools_access_get_children($plugin, $parent) {
}
/**
* Settings form for the 'by ruleset' access plugin
* Settings form for the 'by ruleset' access plugin.
*/
function ctools_ruleset_ctools_access_settings(&$form, &$form_state, $conf) {
if (!empty($form_state['plugin']['ruleset']->admin_description)) {
@ -106,4 +106,3 @@ function ctools_ruleset_ctools_access_summary($conf, $context, $plugin) {
return check_plain($plugin['ruleset']->admin_title);
}
}

View File

@ -1,5 +1,9 @@
<?php
/**
* @file
*/
$plugin = array(
'schema' => 'ctools_access_ruleset',
'access' => 'administer ctools access ruleset',
@ -26,4 +30,3 @@ $plugin = array(
),
),
);

View File

@ -2,7 +2,7 @@
class ctools_access_ruleset_ui extends ctools_export_ui {
function edit_form_context(&$form, &$form_state) {
public function edit_form_context(&$form, &$form_state) {
ctools_include('context-admin');
ctools_context_admin_includes();
ctools_add_css('ruleset');
@ -27,7 +27,7 @@ class ctools_access_ruleset_ui extends ctools_export_ui {
ctools_context_add_relationship_form($module, $form, $form_state, $form['right']['relationships_table'], $form_state['item'], $name);
}
function edit_form_rules(&$form, &$form_state) {
public function edit_form_rules(&$form, &$form_state) {
// The 'access' UI passes everything via $form_state, unlike the 'context' UI.
// The main difference is that one is about 3 years newer than the other.
ctools_include('context');
@ -43,11 +43,12 @@ class ctools_access_ruleset_ui extends ctools_export_ui {
$form = ctools_access_admin_form($form, $form_state);
}
function edit_form_rules_submit(&$form, &$form_state) {
public function edit_form_rules_submit(&$form, &$form_state) {
$form_state['item']->access['logic'] = $form_state['values']['logic'];
}
function edit_form_submit(&$form, &$form_state) {
public function edit_form_submit(&$form, &$form_state) {
parent::edit_form_submit($form, $form_state);
}
}

View File

@ -1,52 +1,52 @@
div.ctools-sample-modal-content {
background:none;
border:0;
color:#000000;
margin:0;
padding:0;
text-align:left;
background: none;
border: 0;
color: #000;
margin: 0;
padding: 0;
text-align: left;
}
div.ctools-sample-modal-content .modal-scroll{
overflow:hidden;
overflow-y:auto;
div.ctools-sample-modal-content .modal-scroll {
overflow: hidden;
overflow-y: auto;
}
div.ctools-sample-modal-content #popups-overlay {
background-color:transparent;
background-color: transparent;
}
div.ctools-sample-modal-content #popups-loading {
width:248px;
position:absolute;
display:none;
opacity:1;
width: 248px;
position: absolute;
display: none;
opacity: 1;
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
z-index:99;
z-index: 99;
}
div.ctools-sample-modal-content #popups-loading span.popups-loading-message {
background:#FFF url(../images/loading-large.gif) no-repeat 8px center;
display:block;
color:#444444;
font-family:Arial;
font-size:22px;
font-weight:bold;
height:36px;
line-height:36px;
padding:0 40px;
background: #fff url(../images/loading-large.gif) no-repeat 8px center;
display: block;
color: #444;
font-family: Arial, serif;
font-size: 22px;
font-weight: bold;
height: 36px;
line-height: 36px;
padding: 0 40px;
}
div.ctools-sample-modal-content #popups-loading table,
div.ctools-sample-modal-content .popups-box table {
margin:0px;
margin: 0;
}
div.ctools-sample-modal-content #popups-loading tbody,
div.ctools-sample-modal-content .popups-box tbody {
border:none;
border: none;
}
div.ctools-sample-modal-content .popups-box tr {
background-color:transparent;
background-color: transparent;
}
div.ctools-sample-modal-content td.popups-border {
background: url(../images/popups-border.png);
background-color:transparent;
background-color: transparent;
border: none;
}
div.ctools-sample-modal-content td.popups-tl,
@ -54,79 +54,94 @@ div.ctools-sample-modal-content td.popups-tr,
div.ctools-sample-modal-content td.popups-bl,
div.ctools-sample-modal-content td.popups-br {
background-repeat: no-repeat;
height:10px;
padding:0px;
height: 10px;
padding: 0;
}
div.ctools-sample-modal-content td.popups-tl {
background-position: 0 0;
}
div.ctools-sample-modal-content td.popups-tl { background-position: 0px 0px; }
div.ctools-sample-modal-content td.popups-t,
div.ctools-sample-modal-content td.popups-b {
background-position: 0px -40px;
background-position: 0 -40px;
background-repeat: repeat-x;
}
div.ctools-sample-modal-content td.popups-tr { background-position: 0px -10px; width: 10px; }
div.ctools-sample-modal-content td.popups-tr {
background-position: 0 -10px;
width: 10px;
}
div.ctools-sample-modal-content td.popups-cl,
div.ctools-sample-modal-content td.popups-cr {
background-position: -10px 0;
background-repeat: repeat-y;
width:10px;
width: 10px;
}
div.ctools-sample-modal-content td.popups-cl,
div.ctools-sample-modal-content td.popups-cr,
div.ctools-sample-modal-content td.popups-c { padding:0; border: none; }
div.ctools-sample-modal-content td.popups-c { background:#fff; }
div.ctools-sample-modal-content td.popups-bl { background-position: 0px -20px; }
div.ctools-sample-modal-content td.popups-br { background-position: 0px -30px; width: 10px; }
div.ctools-sample-modal-content td.popups-c {
padding: 0;
border: none;
}
div.ctools-sample-modal-content td.popups-c {
background: #fff;
}
div.ctools-sample-modal-content td.popups-bl {
background-position: 0 -20px;
}
div.ctools-sample-modal-content td.popups-br {
background-position: 0 -30px;
width: 10px;
}
div.ctools-sample-modal-content .popups-box,
div.ctools-sample-modal-content #popups-loading {
border: 0px solid #454545;
opacity:1;
overflow:hidden;
padding:0;
background-color:transparent;
border: 0 solid #454545;
opacity: 1;
overflow: hidden;
padding: 0;
background-color: transparent;
}
div.ctools-sample-modal-content .popups-container {
overflow:hidden;
height:100%;
background-color:#fff;
overflow: hidden;
height: 100%;
background-color: #fff;
}
div.ctools-sample-modal-content div.popups-title {
-moz-border-radius-topleft: 0px;
-webkit-border-radius-topleft: 0px;
margin-bottom:0px;
background-color:#ff7200;
border:1px solid #ce5c00;
padding:4px 10px 5px;
color:white;
font-size:1em;
font-weight:bold;
-moz-border-radius-topleft: 0;
-webkit-border-radius-topleft: 0;
margin-bottom: 0;
background-color: #ff7200;
border: 1px solid #ce5c00;
padding: 4px 10px 5px;
color: white;
font-size: 1em;
font-weight: bold;
}
div.ctools-sample-modal-content .popups-body {
background-color:#fff;
padding:8px;
background-color: #fff;
padding: 8px;
}
div.ctools-sample-modal-content .popups-box .popups-buttons,
div.ctools-sample-modal-content .popups-box .popups-footer {
background-color:#fff;
background-color: #fff;
}
div.ctools-sample-modal-content .popups-title a.close {
color: #fff;
text-decoration:none;
text-decoration: none;
}
div.ctools-sample-modal-content .popups-close {
font-size:120%;
float:right;
text-align:right;
font-size: 120%;
float: right;
text-align: right;
}
div.ctools-sample-modal-content .modal-loading-wrapper {
width:220px;
height:19px;
margin:0 auto;
margin-top:2%;
width: 220px;
height: 19px;
margin: 0 auto;
margin-top: 2%;
}
div.ctools-sample-modal-content tbody{
border:none;
div.ctools-sample-modal-content tbody {
border: none;
}
div.ctools-sample-modal-content .modal-content .modal-throbber-wrapper img {

View File

@ -1,13 +1,11 @@
name = Chaos Tools (CTools) AJAX Example
description = Shows how to use the power of Chaos AJAX.
package = Chaos tool suite
version = CTOOLS_MODULE_VERSION
dependencies[] = ctools
core = 7.x
; Information added by Drupal.org packaging script on 2016-11-22
version = "7.x-1.12"
; Information added by Drupal.org packaging script on 2019-02-08
version = "7.x-1.15"
core = "7.x"
project = "ctools"
datestamp = "1479787162"
datestamp = "1549603691"

View File

@ -1,18 +1,18 @@
<?php
/**
* @file
* @file
*/
/**
* Implementation of hook_install()
* Implementation of hook_install()
*/
function ctools_ajax_sample_install() {
}
/**
* Implementation of hook_uninstall()
* Implementation of hook_uninstall()
*/
function ctools_ajax_sample_uninstall() {

View File

@ -8,16 +8,16 @@
// ---------------------------------------------------------------------------
// Drupal hooks.
/**
* Implementation of hook_menu()
* Implementation of hook_menu()
*/
function ctools_ajax_sample_menu() {
$items['ctools_ajax_sample'] = array(
'title' => 'Chaos Tools AJAX Demo',
'page callback' => 'ctools_ajax_sample_page',
'access callback' => TRUE,
'type' => MENU_NORMAL_ITEM,
'title' => 'Chaos Tools AJAX Demo',
'page callback' => 'ctools_ajax_sample_page',
'access callback' => TRUE,
'type' => MENU_NORMAL_ITEM,
);
$items['ctools_ajax_sample/simple_form'] = array(
'title' => 'Simple Form',
@ -26,39 +26,39 @@ function ctools_ajax_sample_menu() {
'type' => MENU_CALLBACK,
);
$items['ctools_ajax_sample/%ctools_js/hello'] = array(
'title' => 'Hello World',
'page callback' => 'ctools_ajax_sample_hello',
'page arguments' => array(1),
'access callback' => TRUE,
'type' => MENU_CALLBACK,
'title' => 'Hello World',
'page callback' => 'ctools_ajax_sample_hello',
'page arguments' => array(1),
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
$items['ctools_ajax_sample/%ctools_js/tablenix/%'] = array(
'title' => 'Hello World',
'page callback' => 'ctools_ajax_sample_tablenix',
'page arguments' => array(1, 3),
'access callback' => TRUE,
'type' => MENU_CALLBACK,
'title' => 'Hello World',
'page callback' => 'ctools_ajax_sample_tablenix',
'page arguments' => array(1, 3),
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
$items['ctools_ajax_sample/%ctools_js/login'] = array(
'title' => 'Login',
'page callback' => 'ctools_ajax_sample_login',
'page arguments' => array(1),
'access callback' => TRUE,
'type' => MENU_CALLBACK,
'title' => 'Login',
'page callback' => 'ctools_ajax_sample_login',
'page arguments' => array(1),
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
$items['ctools_ajax_sample/%ctools_js/animal'] = array(
'title' => 'Animal',
'page callback' => 'ctools_ajax_sample_animal',
'page arguments' => array(1),
'access callback' => TRUE,
'type' => MENU_CALLBACK,
'title' => 'Animal',
'page callback' => 'ctools_ajax_sample_animal',
'page arguments' => array(1),
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
$items['ctools_ajax_sample/%ctools_js/login/%'] = array(
'title' => 'Post-Login Action',
'page callback' => 'ctools_ajax_sample_login_success',
'page arguments' => array(1, 3),
'access callback' => TRUE,
'type' => MENU_CALLBACK,
'title' => 'Post-Login Action',
'page callback' => 'ctools_ajax_sample_login_success',
'page arguments' => array(1, 3),
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
$items['ctools_ajax_sample/jumped'] = array(
'title' => 'Successful Jumping',
@ -104,11 +104,11 @@ function ctools_ajax_sample_theme() {
}
// ---------------------------------------------------------------------------
// Page callbacks
// Page callbacks.
/**
* Page callback to display links and render a container for AJAX stuff.
*/
function ctools_ajax_sample_page() {
global $user;
@ -156,14 +156,14 @@ function ctools_ajax_sample_page() {
// The extra class points to the info in ctools-sample-style which we added
// to the settings, prefixed with 'ctools-modal'.
$links[] = ctools_modal_text_button(t('Modal Login (custom style)'), 'ctools_ajax_sample/nojs/login', t('Login via modal'), 'ctools-modal-ctools-sample-style');
$links[] = ctools_modal_text_button(t('Modal Login (custom style)'), 'ctools_ajax_sample/nojs/login', t('Login via modal'), 'ctools-modal-ctools-sample-style');
}
// Four ways to do our animal picking wizard.
$button_form = ctools_ajax_sample_ajax_button_form();
$links[] = l(t('Wizard (no modal)'), 'ctools_ajax_sample/nojs/animal');
$links[] = ctools_modal_text_button(t('Wizard (default modal)'), 'ctools_ajax_sample/nojs/animal', t('Pick an animal'));
$links[] = ctools_modal_text_button(t('Wizard (custom modal)'), 'ctools_ajax_sample/nojs/animal', t('Pick an animal'), 'ctools-modal-ctools-sample-style');
$links[] = ctools_modal_text_button(t('Wizard (custom modal)'), 'ctools_ajax_sample/nojs/animal', t('Pick an animal'), 'ctools-modal-ctools-sample-style');
$links[] = drupal_render($button_form);
$links[] = ctools_ajax_text_button(t('Hello world!'), "ctools_ajax_sample/nojs/hello", t('Replace text with "hello world"'));
@ -176,9 +176,9 @@ function ctools_ajax_sample_page() {
// Create a table that we can have data removed from via AJAX.
$header = array(t('Row'), t('Content'), t('Actions'));
$rows = array();
for($i = 1; $i < 11; $i++) {
for ($i = 1; $i < 11; $i++) {
$rows[] = array(
'class' => array('ajax-sample-row-'. $i),
'class' => array('ajax-sample-row-' . $i),
'data' => array(
$i,
md5($i),
@ -189,10 +189,10 @@ function ctools_ajax_sample_page() {
$output .= theme('table', array('header' => $header, 'rows' => $rows, array('class' => array('ajax-sample-table'))));
// Show examples of ctools javascript widgets
$output .= '<h2>'. t('CTools Javascript Widgets') .'</h2>';
// Show examples of ctools javascript widgets.
$output .= '<h2>' . t('CTools Javascript Widgets') . '</h2>';
// Create a drop down menu
// Create a drop down menu.
$links = array();
$links[] = array('title' => t('Link 1'), 'href' => $_GET['q']);
$links[] = array('title' => t('Link 2'), 'href' => $_GET['q']);
@ -201,16 +201,16 @@ function ctools_ajax_sample_page() {
$output .= '<h3>' . t('Drop Down Menu') . '</h3>';
$output .= theme('ctools_dropdown', array('title' => t('Click to Drop Down'), 'links' => $links));
// Create a collapsible div
// Create a collapsible div.
$handle = t('Click to Collapse');
$content = 'Nulla ligula ante, aliquam at adipiscing egestas, varius vel arcu. Etiam laoreet elementum mi vel consequat. Etiam scelerisque lorem vel neque consequat quis bibendum libero congue. Nulla facilisi. Mauris a elit a leo feugiat porta. Phasellus placerat cursus est vitae elementum.';
$output .= '<h3>'. t('Collapsible Div') .'</h3>';
$output .= '<h3>' . t('Collapsible Div') . '</h3>';
$output .= theme('ctools_collapsible', array('handle' => $handle, 'content' => $content, 'collapsed' => FALSE));
// Create a jump menu
// Create a jump menu.
ctools_include('jump-menu');
$form = drupal_get_form('ctools_ajax_sample_jump_menu_form');
$output .= '<h3>'. t('Jump Menu') .'</h3>';
$output .= '<h3>' . t('Jump Menu') . '</h3>';
$output .= drupal_render($form);
return array('markup' => array('#markup' => $output));
@ -225,7 +225,8 @@ function ctools_ajax_sample_hello($js = NULL) {
ctools_include('ajax');
$commands = array();
$commands[] = ajax_command_html('#ctools-sample', $output);
print ajax_render($commands); // this function exits.
// This function exits.
print ajax_render($commands);
exit;
}
else {
@ -234,7 +235,7 @@ function ctools_ajax_sample_hello($js = NULL) {
}
/**
* Nix a row from a table and restripe.
* Nix a row from a table and restripe.
*/
function ctools_ajax_sample_tablenix($js, $row) {
if (!$js) {
@ -272,7 +273,7 @@ function ctools_ajax_sample_login($js = NULL) {
$output = array();
$inplace = ctools_ajax_text_button(t('remain here'), 'ctools_ajax_sample/nojs/login/inplace', t('Go to your account'));
$account = ctools_ajax_text_button(t('your account'), 'ctools_ajax_sample/nojs/login/user', t('Go to your account'));
$output[] = ctools_modal_command_display(t('Login Success'), '<div class="modal-message">Login successful. You can now choose whether to '. $inplace .', or go to '. $account.'.</div>');
$output[] = ctools_modal_command_display(t('Login Success'), '<div class="modal-message">Login successful. You can now choose whether to ' . $inplace . ', or go to ' . $account . '.</div>');
}
print ajax_render($output);
exit;
@ -283,7 +284,7 @@ function ctools_ajax_sample_login($js = NULL) {
*/
function ctools_ajax_sample_login_success($js, $action) {
if (!$js) {
// we should never be here out of ajax context
// We should never be here out of ajax context.
return MENU_NOT_FOUND;
}
@ -291,11 +292,11 @@ function ctools_ajax_sample_login_success($js, $action) {
ctools_add_js('ajax-responder');
$commands = array();
if ($action == 'inplace') {
// stay here
// Stay here.
$commands[] = ctools_ajax_command_reload();
}
else {
// bounce bounce
// Bounce bounce.
$commands[] = ctools_ajax_command_redirect('user');
}
print ajax_render($commands);
@ -318,18 +319,18 @@ function ctools_ajax_sample_animal($js = NULL, $step = NULL) {
'show back' => TRUE,
'show cancel' => TRUE,
'show return' => FALSE,
'next callback' => 'ctools_ajax_sample_wizard_next',
'next callback' => 'ctools_ajax_sample_wizard_next',
'finish callback' => 'ctools_ajax_sample_wizard_finish',
'cancel callback' => 'ctools_ajax_sample_wizard_cancel',
// this controls order, as well as form labels
// This controls order, as well as form labels.
'order' => array(
'start' => t('Choose animal'),
),
// here we map a step to a form id.
// Here we map a step to a form id.
'forms' => array(
// e.g. this for the step at wombat/create
// e.g. this for the step at wombat/create.
'start' => array(
'form id' => 'ctools_ajax_sample_start'
'form id' => 'ctools_ajax_sample_start',
),
),
);
@ -341,7 +342,6 @@ function ctools_ajax_sample_animal($js = NULL, $step = NULL) {
// in creation.
//
// We skip all this here by just using an id of 1.
$object_id = 1;
if (empty($step)) {
@ -406,7 +406,7 @@ function ctools_ajax_sample_animal($js = NULL, $step = NULL) {
$commands[] = ajax_command_html('#ctools-sample', $animal);
$commands[] = ctools_modal_command_dismiss();
}
else if (!empty($form_state['cancel'])) {
elseif (!empty($form_state['cancel'])) {
// If cancelling, return to the activity.
$commands[] = ctools_modal_command_dismiss();
}
@ -420,7 +420,7 @@ function ctools_ajax_sample_animal($js = NULL, $step = NULL) {
if ($output === FALSE || !empty($form_state['complete'])) {
return $animal;
}
else if (!empty($form_state['cancel'])) {
elseif (!empty($form_state['cancel'])) {
drupal_goto('ctools_ajax_sample');
}
else {
@ -430,11 +430,11 @@ function ctools_ajax_sample_animal($js = NULL, $step = NULL) {
}
// ---------------------------------------------------------------------------
// Themes
// Themes.
/**
* Theme function for main rendered output.
*/
function theme_ctools_ajax_sample_container($vars) {
$output = '<div id="ctools-sample">';
$output .= $vars['content'];
@ -445,7 +445,6 @@ function theme_ctools_ajax_sample_container($vars) {
// ---------------------------------------------------------------------------
// Stuff needed for our little wizard.
/**
* Get a list of our animals and associated forms.
*
@ -453,6 +452,7 @@ function theme_ctools_ajax_sample_container($vars) {
* which is often how it will work in the real world. If using CTools, what
* you would probably really have, here, is a set of plugins for each animal.
*/
function ctools_ajax_sample_animals() {
return array(
'sheep' => array(
@ -478,10 +478,10 @@ function ctools_ajax_sample_animals() {
// ---------------------------------------------------------------------------
// Wizard caching helpers.
/**
* Store our little cache so that we can retain data from form to form.
*/
function ctools_ajax_sample_cache_set($id, $object) {
ctools_include('object-cache');
ctools_object_cache_set('ctools_ajax_sample', $id, $object);
@ -495,7 +495,7 @@ function ctools_ajax_sample_cache_get($id) {
$object = ctools_object_cache_get('ctools_ajax_sample', $id);
if (!$object) {
// Create a default object.
$object = new stdClass;
$object = new stdClass();
$object->type = 'unknown';
$object->name = '';
}
@ -513,12 +513,12 @@ function ctools_ajax_sample_cache_clear($id) {
// ---------------------------------------------------------------------------
// Wizard in-between helpers; what to do between or after forms.
/**
* Handle the 'next' click on the add/edit pane form wizard.
*
* All we need to do is store the updated pane in the cache.
*/
function ctools_ajax_sample_wizard_next(&$form_state) {
ctools_ajax_sample_cache_set($form_state['object_id'], $form_state['object']);
}
@ -542,10 +542,10 @@ function ctools_ajax_sample_wizard_cancel(&$form_state) {
// ---------------------------------------------------------------------------
// Wizard forms for our simple info collection wizard.
/**
* Wizard start form. Choose an animal.
*/
function ctools_ajax_sample_start($form, &$form_state) {
$form_state['title'] = t('Choose animal');
@ -713,7 +713,7 @@ function ctools_ajax_sample_show_raptor($object) {
}
/**
* Helper function to provide a sample jump menu form
* Helper function to provide a sample jump menu form.
*/
function ctools_ajax_sample_jump_menu_form() {
$url = url('ctools_ajax_sample/jumped');
@ -723,7 +723,7 @@ function ctools_ajax_sample_jump_menu_form() {
}
/**
* Provide a message to the user that the jump menu worked
* Provide a message to the user that the jump menu worked.
*/
function ctools_ajax_sample_jump_menu_page() {
$return_link = l(t('Return to the examples page.'), 'ctools_ajax_sample');
@ -732,7 +732,7 @@ function ctools_ajax_sample_jump_menu_page() {
}
/**
* Provide a form for an example ajax modal button
* Provide a form for an example ajax modal button.
*/
function ctools_ajax_sample_ajax_button_form() {
$form = array();

View File

@ -2,12 +2,10 @@ name = Custom content panes
description = Create custom, exportable, reusable content panes for applications like Panels.
core = 7.x
package = Chaos tool suite
version = CTOOLS_MODULE_VERSION
dependencies[] = ctools
; Information added by Drupal.org packaging script on 2016-11-22
version = "7.x-1.12"
; Information added by Drupal.org packaging script on 2019-02-08
version = "7.x-1.15"
core = "7.x"
project = "ctools"
datestamp = "1479787162"
datestamp = "1549603691"

View File

@ -1,5 +1,9 @@
<?php
/**
* @file
*/
/**
* Schema for CTools custom content.
*/

View File

@ -2,7 +2,7 @@
/**
* @file
* ctools_custom_content module
* The ctools_custom_content module.
*
* This module allows styles to be created and managed on behalf of modules
* that implement styles.
@ -30,7 +30,7 @@ function ctools_custom_content_permission() {
*/
function ctools_custom_content_ctools_plugin_directory($module, $plugin) {
// Most of this module is implemented as an export ui plugin, and the
// rest is in ctools/includes/ctools_custom_content.inc
// rest is in ctools/includes/ctools_custom_content.inc.
if ($module == 'ctools' && $plugin == 'export_ui') {
return 'plugins/' . $plugin;
}
@ -41,7 +41,7 @@ function ctools_custom_content_ctools_plugin_directory($module, $plugin) {
*/
function ctools_custom_content_get_pane_links_alter(&$links, $pane, $content_type) {
if ($pane->type == 'custom') {
if(!isset($pane->configuration['name'])) {
if (!isset($pane->configuration['name'])) {
$name_of_pane = $pane->subtype;
}
else {
@ -80,7 +80,7 @@ function ctools_custom_content_panels_dashboard_blocks(&$vars) {
'description' => t('Custom content panes are basic HTML you enter that can be reused in all of your panels.'),
);
// Load all mini panels and their displays.
// Load all mini panels and their displays.
ctools_include('export');
$items = ctools_export_crud_load_all('ctools_custom_content');
$count = 0;

View File

@ -1,5 +1,9 @@
<?php
/**
* @file
*/
$plugin = array(
'schema' => 'ctools_custom_content',
'access' => 'administer custom content',
@ -17,4 +21,3 @@ $plugin = array(
'handler' => 'ctools_custom_content_ui',
);

View File

@ -2,7 +2,7 @@
class ctools_custom_content_ui extends ctools_export_ui {
function edit_form(&$form, &$form_state) {
public function edit_form(&$form, &$form_state) {
// Correct for an error that came in because filter format changed.
if (is_array($form_state['item']->settings['body'])) {
$form_state['item']->settings['format'] = $form_state['item']->settings['body']['format'];
@ -54,7 +54,7 @@ class ctools_custom_content_ui extends ctools_export_ui {
);
}
function edit_form_submit(&$form, &$form_state) {
public function edit_form_submit(&$form, &$form_state) {
parent::edit_form_submit($form, $form_state);
// Since items in our settings are not in the schema, we have to do these manually:
@ -65,7 +65,7 @@ class ctools_custom_content_ui extends ctools_export_ui {
$form_state['item']->settings['substitute'] = $form_state['values']['substitute'];
}
function list_form(&$form, &$form_state) {
public function list_form(&$form, &$form_state) {
parent::list_form($form, $form_state);
$options = array('all' => t('- All -'));
@ -82,7 +82,7 @@ class ctools_custom_content_ui extends ctools_export_ui {
);
}
function list_filter($form_state, $item) {
public function list_filter($form_state, $item) {
if ($form_state['values']['category'] != 'all' && $form_state['values']['category'] != $item->category) {
return TRUE;
}
@ -90,7 +90,7 @@ class ctools_custom_content_ui extends ctools_export_ui {
return parent::list_filter($form_state, $item);
}
function list_sort_options() {
public function list_sort_options() {
return array(
'disabled' => t('Enabled, title'),
'title' => t('Title'),
@ -100,21 +100,25 @@ class ctools_custom_content_ui extends ctools_export_ui {
);
}
function list_build_row($item, &$form_state, $operations) {
// Set up sorting
public function list_build_row($item, &$form_state, $operations) {
// Set up sorting.
switch ($form_state['values']['order']) {
case 'disabled':
$this->sorts[$item->name] = empty($item->disabled) . $item->admin_title;
break;
case 'title':
$this->sorts[$item->name] = $item->admin_title;
break;
case 'name':
$this->sorts[$item->name] = $item->name;
break;
case 'category':
$this->sorts[$item->name] = $item->category;
break;
case 'storage':
$this->sorts[$item->name] = $item->type . $item->admin_title;
break;
@ -134,7 +138,7 @@ class ctools_custom_content_ui extends ctools_export_ui {
);
}
function list_table_header() {
public function list_table_header() {
return array(
array('data' => t('Name'), 'class' => array('ctools-export-ui-name')),
array('data' => t('Title'), 'class' => array('ctools-export-ui-title')),

View File

@ -11,4 +11,4 @@ There are a number of ways to profit from this:
2. There is a sample panel. You can access it at /ctools_plugin_example/xxxx
to see how it works.
3. There is Advanced Help at admin/advanced_help/ctools_plugin_example.
3. There is Advanced Help at admin/advanced_help/ctools_plugin_example.

View File

@ -1,16 +1,14 @@
name = Chaos Tools (CTools) Plugin Example
description = Shows how an external module can provide ctools plugins (for Panels, etc.).
package = Chaos tool suite
version = CTOOLS_MODULE_VERSION
dependencies[] = ctools
dependencies[] = panels
dependencies[] = page_manager
dependencies[] = advanced_help
core = 7.x
; Information added by Drupal.org packaging script on 2016-11-22
version = "7.x-1.12"
; Information added by Drupal.org packaging script on 2019-02-08
version = "7.x-1.15"
core = "7.x"
project = "ctools"
datestamp = "1479787162"
datestamp = "1549603691"

View File

@ -1,9 +1,8 @@
<?php
/*
/**
* @file
*
* Working sample module to demonstrate CTools 3 plugins
* Working sample module to demonstrate CTools 3 plugins.
*
* This sample module is only intended to demonstrate how external modules can
* provide ctools plugins. There is no useful functionality, and it's only
@ -25,7 +24,7 @@
*/
/**
* Implements hook_menu
* Implements hook_menu.
*/
function ctools_plugin_example_menu() {
$items = array();
@ -58,7 +57,7 @@ function ctools_plugin_example_ctools_plugin_directory($module, $plugin) {
* Implement hook_ctools_plugin_api().
*
* If you do this, CTools will pick up default panels pages in
* <modulename>.pages_default.inc
* <modulename>.pages_default.inc.
*/
function ctools_plugin_example_ctools_plugin_api($module, $api) {
// @todo -- this example should explain how to put it in a different file.
@ -71,7 +70,8 @@ function ctools_plugin_example_ctools_plugin_api($module, $api) {
}
/**
* Just provide an explanation page for the admin section
* Just provide an explanation page for the admin section.
*
* @return unknown_type
*/
function ctools_plugin_example_explanation_page() {

View File

@ -6,7 +6,7 @@
*/
/**
* Default panels pages for CTools Plugin Example
* Default panels pages for CTools Plugin Example.
*
* To pick up this file, your module needs to implement
* hook_ctools_plugin_api() - See ctools_plugin_example_ctools_plugin_api() in
@ -23,12 +23,10 @@
* @return
* Array of pages, normally exported from Panels.
*/
function ctools_plugin_example_default_page_manager_pages() {
// begin exported panel.
$page = new stdClass;
// Begin exported panel.
$page = new stdClass();
$page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */
$page->api_version = 1;
$page->name = 'ctools_plugin_example';
@ -37,31 +35,31 @@ function ctools_plugin_example_default_page_manager_pages() {
$page->admin_description = 'This panel provides no functionality to a working Drupal system. It\'s intended to display the various sample plugins provided by the CTools Plugin Example module. ';
$page->path = 'ctools_plugin_example/%sc';
$page->access = array(
'logic' => 'and',
'logic' => 'and',
);
$page->menu = array(
'type' => 'normal',
'title' => 'CTools plugin example',
'name' => 'navigation',
'weight' => '0',
'parent' => array(
'type' => 'none',
'title' => '',
'type' => 'normal',
'title' => 'CTools plugin example',
'name' => 'navigation',
'weight' => '0',
),
'parent' => array(
'type' => 'none',
'title' => '',
'name' => 'navigation',
'weight' => '0',
),
);
$page->arguments = array(
'sc' => array(
'id' => 2,
'identifier' => 'simplecontext-arg',
'name' => 'simplecontext_arg',
'settings' => array(),
),
'sc' => array(
'id' => 2,
'identifier' => 'simplecontext-arg',
'name' => 'simplecontext_arg',
'settings' => array(),
),
);
$page->conf = array();
$page->default_handlers = array();
$handler = new stdClass;
$handler = new stdClass();
$handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */
$handler->api_version = 1;
$handler->name = 'page_ctools_panel_context';
@ -70,44 +68,45 @@ function ctools_plugin_example_default_page_manager_pages() {
$handler->handler = 'panel_context';
$handler->weight = 0;
$handler->conf = array(
'title' => 'Panel',
'no_blocks' => FALSE,
'css_id' => '',
'css' => '',
'contexts' => array(
'0' => array(
'name' => 'simplecontext',
'id' => 1,
'identifier' => 'Configured simplecontext (not from argument)',
'keyword' => 'configured_simplecontext',
'context_settings' => array(
'sample_simplecontext_setting' => 'default simplecontext setting',
),
),
),
'relationships' => array(
'0' => array(
'context' => 'argument_simplecontext_arg_2',
'name' => 'relcontext_from_simplecontext',
'id' => 1,
'identifier' => 'Relcontext from simplecontext (from relationship)',
'keyword' => 'relcontext',
),
),
'access' => array(
'logic' => 'and',
),
'title' => 'Panel',
'no_blocks' => FALSE,
'css_id' => '',
'css' => '',
'contexts' => array(
'0' => array(
'name' => 'simplecontext',
'id' => 1,
'identifier' => 'Configured simplecontext (not from argument)',
'keyword' => 'configured_simplecontext',
'context_settings' => array(
'sample_simplecontext_setting' => 'default simplecontext setting',
),
),
),
'relationships' => array(
'0' => array(
'context' => 'argument_simplecontext_arg_2',
'name' => 'relcontext_from_simplecontext',
'id' => 1,
'identifier' => 'Relcontext from simplecontext (from relationship)',
'keyword' => 'relcontext',
),
),
'access' => array(
'logic' => 'and',
),
'pipeline' => 'standard',
);
$display = new panels_display;
$display = new panels_display();
$display->layout = 'threecol_33_34_33_stacked';
$display->layout_settings = array();
$display->panel_settings = array(
'style' => 'rounded_corners',
'style_settings' => array(
'default' => array(
'corner_location' => 'pane',
),
),
'style' => 'rounded_corners',
'style_settings' => array(
'default' => array(
'corner_location' => 'pane',
),
),
);
$display->cache = array();
$display->title = 'CTools plugin example panel';
@ -115,7 +114,7 @@ function ctools_plugin_example_default_page_manager_pages() {
$display->title_pane = 1;
$display->content = array();
$display->panels = array();
$pane = new stdClass;
$pane = new stdClass();
$pane->pid = 'new-1';
$pane->panel = 'left';
$pane->type = 'no_context_content_type';
@ -135,7 +134,7 @@ function ctools_plugin_example_default_page_manager_pages() {
$pane->position = 0;
$display->content['new-1'] = $pane;
$display->panels['left'][0] = 'new-1';
$pane = new stdClass;
$pane = new stdClass();
$pane->pid = 'new-2';
$pane->panel = 'left';
$pane->type = 'custom';
@ -148,15 +147,15 @@ function ctools_plugin_example_default_page_manager_pages() {
'settings' => array(
'greater_than' => '1',
'arg_length' => '4',
),
),
'context' => 'argument_simplecontext_arg_2',
),
),
),
),
);
$pane->configuration = array(
'title' => 'Long Arg Visibility Block',
'body' => 'This block will be here when the argument is longer than configured arg length. It uses the \'arg_length\' access plugin to test against the length of the argument used for Simplecontext.',
'format' => '1',
'format' => 'filtered_html',
'substitute' => 1,
);
$pane->cache = array();
@ -166,7 +165,7 @@ function ctools_plugin_example_default_page_manager_pages() {
$pane->position = 1;
$display->content['new-2'] = $pane;
$display->panels['left'][1] = 'new-2';
$pane = new stdClass;
$pane = new stdClass();
$pane->pid = 'new-3';
$pane->panel = 'left';
$pane->type = 'custom';
@ -179,15 +178,15 @@ function ctools_plugin_example_default_page_manager_pages() {
'settings' => array(
'greater_than' => '0',
'arg_length' => '4',
),
),
'context' => 'argument_simplecontext_arg_2',
),
),
),
),
);
$pane->configuration = array(
'title' => 'Short Arg Visibility',
'body' => 'This block appears when the simplecontext argument is <i>less than</i> the configured length.',
'format' => '1',
'format' => 'filtered_html',
'substitute' => 1,
);
$pane->cache = array();
@ -197,7 +196,7 @@ function ctools_plugin_example_default_page_manager_pages() {
$pane->position = 2;
$display->content['new-3'] = $pane;
$display->panels['left'][2] = 'new-3';
$pane = new stdClass;
$pane = new stdClass();
$pane->pid = 'new-4';
$pane->panel = 'middle';
$pane->type = 'simplecontext_content_type';
@ -241,7 +240,7 @@ function ctools_plugin_example_default_page_manager_pages() {
$pane->position = 0;
$display->content['new-4'] = $pane;
$display->panels['middle'][0] = 'new-4';
$pane = new stdClass;
$pane = new stdClass();
$pane->pid = 'new-5';
$pane->panel = 'middle';
$pane->type = 'simplecontext_content_type';
@ -285,7 +284,7 @@ function ctools_plugin_example_default_page_manager_pages() {
$pane->position = 1;
$display->content['new-5'] = $pane;
$display->panels['middle'][1] = 'new-5';
$pane = new stdClass;
$pane = new stdClass();
$pane->pid = 'new-6';
$pane->panel = 'middle';
$pane->type = 'custom';
@ -299,7 +298,7 @@ function ctools_plugin_example_default_page_manager_pages() {
item1 is %sc:item1
item2 is %sc:item2
description is %sc:description',
'format' => '1',
'format' => 'filtered_html',
'substitute' => 1,
);
$pane->cache = array();
@ -309,7 +308,7 @@ function ctools_plugin_example_default_page_manager_pages() {
$pane->position = 2;
$display->content['new-6'] = $pane;
$display->panels['middle'][2] = 'new-6';
$pane = new stdClass;
$pane = new stdClass();
$pane->pid = 'new-7';
$pane->panel = 'right';
$pane->type = 'relcontext_content_type';
@ -353,7 +352,7 @@ function ctools_plugin_example_default_page_manager_pages() {
$pane->position = 0;
$display->content['new-7'] = $pane;
$display->panels['right'][0] = 'new-7';
$pane = new stdClass;
$pane = new stdClass();
$pane->pid = 'new-8';
$pane->panel = 'top';
$pane->type = 'custom';
@ -365,7 +364,7 @@ function ctools_plugin_example_default_page_manager_pages() {
'body' => 'The CTools Plugin Example module (and this panel page) are just here to demonstrate how to build CTools plugins.
',
'format' => '2',
'format' => 'full_html',
'substitute' => 1,
);
$pane->cache = array();
@ -378,12 +377,11 @@ function ctools_plugin_example_default_page_manager_pages() {
$handler->conf['display'] = $display;
$page->default_handlers[$handler->name] = $handler;
// end of exported panel.
// End of exported panel.
$pages['ctools_plugin_example_demo_page'] = $page;
// begin exported panel
$page = new stdClass;
// Begin exported panel.
$page = new stdClass();
$page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */
$page->api_version = 1;
$page->name = 'ctools_plugin_example_base';
@ -396,7 +394,7 @@ function ctools_plugin_example_default_page_manager_pages() {
$page->arguments = array();
$page->conf = array();
$page->default_handlers = array();
$handler = new stdClass;
$handler = new stdClass();
$handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */
$handler->api_version = 1;
$handler->name = 'page_ctools_plugin_example_base_panel_context';
@ -405,14 +403,15 @@ function ctools_plugin_example_default_page_manager_pages() {
$handler->handler = 'panel_context';
$handler->weight = 0;
$handler->conf = array(
'title' => 'Panel',
'no_blocks' => FALSE,
'css_id' => '',
'css' => '',
'contexts' => array(),
'relationships' => array(),
'title' => 'Panel',
'no_blocks' => FALSE,
'css_id' => '',
'css' => '',
'contexts' => array(),
'relationships' => array(),
'pipeline' => 'standard',
);
$display = new panels_display;
$display = new panels_display();
$display->layout = 'onecol';
$display->layout_settings = array();
$display->panel_settings = array();
@ -421,7 +420,7 @@ function ctools_plugin_example_default_page_manager_pages() {
$display->hide_title = FALSE;
$display->content = array();
$display->panels = array();
$pane = new stdClass;
$pane = new stdClass();
$pane->pid = 'new-1';
$pane->panel = 'middle';
$pane->type = 'custom';
@ -431,7 +430,7 @@ function ctools_plugin_example_default_page_manager_pages() {
$pane->configuration = array(
'title' => 'Use this page with an argument',
'body' => 'This demo page works if you use an argument, like <a href="ctools_plugin_example/xxxxx">ctools_plugin_example/xxxxx</a>.',
'format' => '1',
'format' => 'filtered_html',
'substitute' => NULL,
);
$pane->cache = array();
@ -443,9 +442,8 @@ function ctools_plugin_example_default_page_manager_pages() {
$display->panels['middle'][0] = 'new-1';
$handler->conf['display'] = $display;
$page->default_handlers[$handler->name] = $handler;
// end exported panel.
// End exported panel.
$pages['base_page'] = $page;
return $pages;
}
}

View File

@ -59,7 +59,8 @@ function ctools_plugin_example_arg_length_ctools_access_check($conf, $context) {
*/
function ctools_plugin_example_arg_length_ctools_access_summary($conf, $context) {
return t('Simpletext argument must be !comp @length characters',
array('!comp' => $conf['greater_than'] ? 'greater than' : 'less than or equal to',
'@length' => $conf['arg_length']));
array(
'!comp' => $conf['greater_than'] ? 'greater than' : 'less than or equal to',
'@length' => $conf['arg_length'],
));
}

View File

@ -4,7 +4,7 @@
* @file
* Plugin to provide access control based upon role membership.
* This is directly from the ctools module, but serves as a good
* example of an access plugin
* example of an access plugin.
*/
/**
@ -73,4 +73,3 @@ function ctools_plugin_example_example_role_ctools_access_summary($conf, $contex
}
return format_plural(count($names), '@identifier must have role "@roles"', '@identifier can be one of "@roles"', array('@roles' => implode(', ', $names), '@identifier' => $context->identifier));
}

View File

@ -2,7 +2,6 @@
/**
* @file
*
* Sample plugin to provide an argument handler for a simplecontext.
*
* Given any argument to the page, simplecontext will get it
@ -18,14 +17,12 @@
*/
$plugin = array(
'title' => t("Simplecontext arg"),
// keyword to use for %substitution
// Keyword to use for %substitution.
'keyword' => 'simplecontext',
'description' => t('Creates a "simplecontext" from the arg.'),
'context' => 'simplecontext_arg_context',
// 'settings form' => 'simplecontext_arg_settings_form',
// placeholder_form is used in panels preview, for example, so we can
// preview without getting the arg from a URL
// preview without getting the arg from a URL.
'placeholder form' => array(
'#type' => 'textfield',
'#description' => t('Enter the simplecontext arg'),

View File

@ -5,7 +5,6 @@
* "No context" sample content type. It operates with no context at all. It would
* be basically the same as a 'custom content' block, but it's not even that
* sophisticated.
*
*/
/**
@ -33,7 +32,7 @@ $plugin = array(
'icon' => 'icon_example.png',
'category' => array(t('CTools Examples'), -9),
// this example does not provide 'admin info', which would populate the
// This example does not provide 'admin info', which would populate the
// panels builder page preview.
);
@ -56,7 +55,7 @@ function no_context_content_type_render($subtype, $conf, $args, $context) {
$ctools_help = theme('advanced_help_topic', array('module' => 'ctools', 'topic' => 'plugins', 'type' => 'title'));
$ctools_plugin_example_help = theme('advanced_help_topic', array('module' => 'ctools_plugin_example', 'topic' => 'Chaos-Tools--CTools--Plugin-Examples', 'type' => 'title'));
// The title actually used in rendering
// The title actually used in rendering.
$block->title = check_plain("No-context content type");
$block->content = t("
<div>Welcome to the CTools Plugin Example demonstration content type.
@ -84,7 +83,6 @@ function no_context_content_type_render($subtype, $conf, $args, $context) {
* Note that if we had not provided an entry for this in hook_content_types,
* this could have had the default name
* ctools_plugin_example_no_context_content_type_edit_form.
*
*/
function no_context_content_type_edit_form($form, &$form_state) {
$conf = $form_state['conf'];

View File

@ -1,6 +1,5 @@
<?php
/**
* @file
* Content type that displays the relcontext context type.
@ -27,9 +26,8 @@ $plugin = array(
'category' => array(t('CTools Examples'), -9),
'edit form' => 'relcontext_edit_form',
// this example does not provide 'admin info', which would populate the
// This example does not provide 'admin info', which would populate the
// panels builder page preview.
);
/**
@ -60,7 +58,7 @@ function relcontext_content_type_render($subtype, $conf, $args, $context) {
In our case, the configuration form (\$conf) has just one field, 'config_item_1;
and it's configured with:
");
if (!empty($conf)) {
if (!empty($conf)) {
$block->content .= '<div style="border: 1px solid red;">' . var_export($conf['config_item_1'], TRUE) . '</div>';
}
if (!empty($context)) {
@ -77,7 +75,6 @@ function relcontext_content_type_render($subtype, $conf, $args, $context) {
/**
* 'Edit' callback for the content type.
* This example just returns a form.
*
*/
function relcontext_edit_form($form, &$form_state) {
$conf = $form_state['conf'];

View File

@ -1,6 +1,5 @@
<?php
/**
* @file
* Sample ctools content type that takes advantage of context.
@ -9,7 +8,6 @@
* ctools content type can access and use context. Note that the simplecontext
* can be either configured manually into a panel or it can be retrieved via
* an argument.
*
*/
/**
@ -31,7 +29,7 @@ $plugin = array(
'edit form' => 'simplecontext_content_type_edit_form',
'admin title' => 'ctools_plugin_example_simplecontext_content_type_admin_title',
// presents a block which is used in the preview of the data.
// Presents a block which is used in the preview of the data.
// Pn Panels this is the preview pane shown on the panels building page.
'admin info' => 'ctools_plugin_example_simplecontext_content_type_admin_info',
'category' => array(t('CTools Examples'), -9),
@ -103,7 +101,6 @@ function simplecontext_content_type_render($subtype, $conf, $args, $context) {
/**
* 'Edit' callback for the content type.
* This example just returns a form.
*
*/
function simplecontext_content_type_edit_form($form, &$form_state) {
$conf = $form_state['conf'];

View File

@ -80,4 +80,3 @@ function relcontext_settings_form($conf, $external = FALSE) {
);
return $form;
}

View File

@ -1,10 +1,8 @@
<?php
/**
* @file
* Sample ctools context type plugin that shows how to create a context from an arg.
*
*/
/**
@ -14,7 +12,8 @@
$plugin = array(
'title' => t("Simplecontext"),
'description' => t('A single "simplecontext" context, or data element.'),
'context' => 'ctools_plugin_example_context_create_simplecontext', // func to create context
// Func to create context.
'context' => 'ctools_plugin_example_context_create_simplecontext',
'context name' => 'simplecontext',
'settings form' => 'simplecontext_settings_form',
'keyword' => 'simplecontext',
@ -69,7 +68,7 @@ function ctools_plugin_example_context_create_simplecontext($empty, $data = NULL
// This is used for keyword.
$context->title = $data;
$context->argument = $data;
// Make up a bogus context
// Make up a bogus context.
$context->data = new stdClass();
$context->data->item1 = t("Item1");
$context->data->item2 = t("Item2");
@ -102,8 +101,6 @@ function simplecontext_settings_form($conf, $external = FALSE) {
return $form;
}
/**
* Provide a list of sub-keywords.
*
@ -125,10 +122,11 @@ function simplecontext_convert($context, $type) {
switch ($type) {
case 'item1':
return $context->data->item1;
case 'item2':
return $context->data->item2;
case 'description':
return $context->data->description;
}
}

View File

@ -19,24 +19,24 @@ function ctools_plugin_example_default_panel_pages() {
$page->load_flags = 1;
$page->css_id = '';
$page->arguments = array(
0 =>
0 =>
array(
'name' => 'simplecontext_arg',
'id' => 1,
'default' => '404',
'title' => '',
'identifier' => 'Simplecontext arg',
'keyword' => 'simplecontext',
'name' => 'simplecontext_arg',
'id' => 1,
'default' => '404',
'title' => '',
'identifier' => 'Simplecontext arg',
'keyword' => 'simplecontext',
),
);
$page->relationships = array(
0 =>
0 =>
array(
'context' => 'argument_simplecontext_arg_1',
'name' => 'relcontext_from_simplecontext',
'id' => 1,
'identifier' => 'Relcontext from Simplecontext',
'keyword' => 'relcontext',
'context' => 'argument_simplecontext_arg_1',
'name' => 'relcontext_from_simplecontext',
'id' => 1,
'identifier' => 'Relcontext from Simplecontext',
'keyword' => 'relcontext',
),
);
$page->no_blocks = '0';
@ -58,14 +58,14 @@ function ctools_plugin_example_default_panel_pages() {
$pane->subtype = 'custom';
$pane->access = array();
$pane->configuration = array(
'style' => 'default',
'override_title' => 0,
'override_title_text' => '',
'css_id' => '',
'css_class' => '',
'title' => '"No Context Item"',
'body' => 'The "no context item" content type is here to demonstrate that you can create a content_type that does not require a context. This is probably the same as just creating a custom php block on the fly, and might serve the same purpose.',
'format' => '1',
'style' => 'default',
'override_title' => 0,
'override_title_text' => '',
'css_id' => '',
'css_class' => '',
'title' => '"No Context Item"',
'body' => 'The "no context item" content type is here to demonstrate that you can create a content_type that does not require a context. This is probably the same as just creating a custom php block on the fly, and might serve the same purpose.',
'format' => '1',
);
$pane->cache = array();
$display->content['new-1'] = $pane;
@ -78,14 +78,14 @@ function ctools_plugin_example_default_panel_pages() {
$pane->subtype = 'description';
$pane->access = array();
$pane->configuration = array(
'style' => 'default',
'override_title' => 0,
'override_title_text' => '',
'css_id' => '',
'css_class' => '',
'item1' => 'one',
'item2' => 'two',
'item3' => 'three',
'style' => 'default',
'override_title' => 0,
'override_title_text' => '',
'css_id' => '',
'css_class' => '',
'item1' => 'one',
'item2' => 'two',
'item3' => 'three',
);
$pane->cache = array();
$display->content['new-2'] = $pane;
@ -98,16 +98,16 @@ function ctools_plugin_example_default_panel_pages() {
$pane->subtype = 'custom';
$pane->access = array();
$pane->configuration = array(
'style' => 'default',
'override_title' => 0,
'override_title_text' => '',
'css_id' => '',
'css_class' => '',
'title' => 'Simplecontext',
'body' => 'The "Simplecontext" content and content type demonstrate a very basic context and how to display it.
'style' => 'default',
'override_title' => 0,
'override_title_text' => '',
'css_id' => '',
'css_class' => '',
'title' => 'Simplecontext',
'body' => 'The "Simplecontext" content and content type demonstrate a very basic context and how to display it.
Simplecontext includes configuration, so it can get info from the config. It can also get its information to run from a simplecontext context, generated either from an arg to the panels page or via explicitly adding a context to the page.',
'format' => '1',
'format' => '1',
);
$pane->cache = array();
$display->content['new-3'] = $pane;
@ -119,17 +119,17 @@ function ctools_plugin_example_default_panel_pages() {
$pane->shown = '1';
$pane->subtype = 'description';
$pane->access = array(
0 => '2',
1 => '4',
0 => '2',
1 => '4',
);
$pane->configuration = array(
'context' => 'argument_simplecontext_arg_1',
'style' => 'default',
'override_title' => 0,
'override_title_text' => '',
'css_id' => '',
'css_class' => '',
'config_item_1' => 'simplecontext called from arg',
'context' => 'argument_simplecontext_arg_1',
'style' => 'default',
'override_title' => 0,
'override_title_text' => '',
'css_id' => '',
'css_class' => '',
'config_item_1' => 'simplecontext called from arg',
);
$pane->cache = array();
$display->content['new-4'] = $pane;
@ -142,14 +142,14 @@ function ctools_plugin_example_default_panel_pages() {
$pane->subtype = 'custom';
$pane->access = array();
$pane->configuration = array(
'style' => 'default',
'override_title' => 0,
'override_title_text' => '',
'css_id' => '',
'css_class' => '',
'title' => 'Relcontext',
'body' => 'The relcontext content_type gets its data from a relcontext, which is an example of a relationship. This panel should be run with an argument like "/xxx", which allows the simplecontext to get its context, and then the relcontext is configured in this panel to get (create) its data from the simplecontext.',
'format' => '1',
'style' => 'default',
'override_title' => 0,
'override_title_text' => '',
'css_id' => '',
'css_class' => '',
'title' => 'Relcontext',
'body' => 'The relcontext content_type gets its data from a relcontext, which is an example of a relationship. This panel should be run with an argument like "/xxx", which allows the simplecontext to get its context, and then the relcontext is configured in this panel to get (create) its data from the simplecontext.',
'format' => '1',
);
$pane->cache = array();
$display->content['new-5'] = $pane;
@ -162,13 +162,13 @@ function ctools_plugin_example_default_panel_pages() {
$pane->subtype = 'description';
$pane->access = array();
$pane->configuration = array(
'context' => 'relationship_relcontext_from_simplecontext_1',
'style' => 'default',
'override_title' => 0,
'override_title_text' => '',
'css_id' => '',
'css_class' => '',
'config_item_1' => 'default1',
'context' => 'relationship_relcontext_from_simplecontext_1',
'style' => 'default',
'override_title' => 0,
'override_title_text' => '',
'css_id' => '',
'css_class' => '',
'config_item_1' => 'default1',
);
$pane->cache = array();
$display->content['new-6'] = $pane;
@ -181,13 +181,13 @@ function ctools_plugin_example_default_panel_pages() {
$pane->subtype = 'custom_php';
$pane->access = array();
$pane->configuration = array(
'style' => 'default',
'override_title' => 0,
'override_title_text' => '',
'css_id' => '',
'css_class' => '',
'title' => '',
'body' => '$arg = arg(1);
'style' => 'default',
'override_title' => 0,
'override_title_text' => '',
'css_id' => '',
'css_class' => '',
'title' => '',
'body' => '$arg = arg(1);
$arg0 = arg(0);
if (!$arg) {
$block->content = <<<END
@ -209,6 +209,5 @@ END;
$page->displays = array();
$pages['ctools_plugin_example'] = $page;
return $pages;
}

View File

@ -1,9 +1,7 @@
<?php
/**
* @file
*
* Sample relationship plugin.
*
* We take a simplecontext, look in it for what we need to make a relcontext, and make it.
@ -33,7 +31,6 @@ function ctools_relcontext_from_simplecontext_context($context = NULL, $conf) {
}
// You should do error-checking here.
// Create the new context from some element of the parent context.
// In this case, we'll pass in the whole context so it can be used to
// create the relcontext.
@ -47,4 +44,3 @@ function ctools_relcontext_from_simplecontext_settings_form($conf) {
// We won't configure it in this case.
return array();
}

View File

@ -140,13 +140,14 @@ function ctools_drush_help($section) {
switch ($section) {
case 'meta:ctools:title':
return dt('CTools commands');
case 'meta:entity:summary':
return dt('CTools drush commands.');
}
}
/**
* Drush callback: export
* Drush callback: export.
*/
function ctools_drush_export($module = 'foo') {
$error = FALSE;
@ -338,7 +339,7 @@ function _ctools_drush_selection_screen(array $tables = array()) {
$build[$table_choice]['count'] = count($multi_select);
$selections[$table_choice] = array();
foreach ($multi_select as $key) {
$selections[$table_choice][$key] = $key;
$selections[$table_choice][$key] = $key;
}
}
}
@ -445,11 +446,13 @@ function ctools_drush_export_info() {
}
}
}
/**
* Drush callback: Acts as the hub for all op commands to keep
* all arg handling etc in one place.
*/
function ctools_drush_export_op_command() {
$args = func_get_args();
// Get all info for the current drush command.
$command = drush_get_command();
$op = '';
@ -457,17 +460,20 @@ function ctools_drush_export_op_command() {
switch ($command['command']) {
case 'ctools-export-view':
$op = 'view';
break;
break;
case 'ctools-export-revert':
// Revert is same as deleting. As any objects in the db are deleted.
$op = 'delete';
break;
break;
case 'ctools-export-enable':
$op = 'enable';
break;
break;
case 'ctools-export-disable':
$op = 'disable';
break;
break;
}
if (!$op) {
@ -475,7 +481,7 @@ function ctools_drush_export_op_command() {
}
if (drush_get_option('all', FALSE)) {
$info = _ctools_drush_export_info('', TRUE);
$info = _ctools_drush_export_info(array(), TRUE);
$exportable_info = $info['exportables'];
$all = drush_confirm(dt('Are you sure you would like to !op all exportables on the system?',
@ -490,7 +496,6 @@ function ctools_drush_export_op_command() {
}
}
else {
$args = func_get_args();
// Table name should always be first arg...
$table_name = array_shift($args);
// Any additional args are assumed to be exportable names.
@ -512,7 +517,6 @@ function ctools_drush_export_op_command() {
* @param $op
* @param $table_name
* @param $exportables
*
*/
function ctools_drush_export_op($op = '', $table_name = '', $exportables = NULL) {
$objects = ctools_export_crud_load_multiple($table_name, array_keys($exportables));
@ -538,7 +542,7 @@ function ctools_drush_export_op($op = '', $table_name = '', $exportables = NULL)
* @param $object_names
*
* @return
* Array of exportable objects (filtered if necessary, by name etc..) or FALSE if not.
* Array of exportable objects (filtered if necessary, by name etc..) or FALSE if not.
*/
function _ctools_drush_export_op_command_logic($op = '', $table_name = NULL, array $object_names = array()) {
if (!$table_name) {
@ -644,7 +648,7 @@ function _ctools_drush_export_info(array $table_names = array(), $load = FALSE)
return array('exportables' => $exportables, 'schemas' => $schemas);
}
/*
/**
* View a single object.
*
* @param $table_name
@ -662,7 +666,7 @@ function _ctools_drush_export_view($table_name, $object) {
}
}
/*
/**
* Revert a single object.
*
* @param $table_name
@ -681,7 +685,7 @@ function _ctools_drush_export_delete($table_name, $object) {
}
}
/*
/**
* Enable a single object.
*
* @param $table_name
@ -701,7 +705,7 @@ function _ctools_drush_export_enable($table_name, $object) {
}
}
/*
/**
* Disable a single object.
*
* @param $table_name
@ -723,9 +727,9 @@ function _ctools_drush_export_disable($table_name, $object) {
/**
* Filter a nested array of exportables by export module.
*
* @param $exportables array
* @param array $exportables
* Passed by reference. A nested array of exportables, keyed by table name.
* @param $export_module string
* @param string $export_module
* The name of the export module providing the exportable.
*/
function _ctools_drush_export_module_filter($exportables, $export_module) {
@ -778,7 +782,7 @@ function _ctools_drush_object_is_disabled($object) {
/**
* Determine if an object is enabled.
*
* @see _ctools_drush_object_is_disabled.
* @see _ctools_drush_object_is_disabled()
*/
function _ctools_drush_object_is_enabled($object) {
return (empty($object->disabled)) ? TRUE : FALSE;
@ -835,7 +839,7 @@ function _ctools_drush_object_is_not_code_only($object) {
* Array of exportables to count.
*
* @return
* Array of count data containing the following:
* Array of count data containing the following:
* 'total' - A total count of all exportables.
* 'exportables' - An array of exportable counts per table.
*/
@ -867,26 +871,32 @@ function _ctools_drush_filter_exportables($exportables, $filter) {
// Show enabled exportables only.
case 'enabled':
$eval = '_ctools_drush_object_is_disabled';
break;
break;
// Show disabled exportables only.
case 'disabled':
$eval = '_ctools_drush_object_is_enabled';
break;
break;
// Show overridden exportables only.
case 'overridden':
$eval = '_ctools_drush_object_is_not_overridden';
break;
break;
// Show database only exportables.
case 'database':
$eval = '_ctools_drush_object_is_not_db_only';
break;
break;
// Show code only exportables.
case 'code':
$eval = '_ctools_drush_object_is_not_code_only';
break;
break;
// Do nothing.
case 'all':
break;
default:
drush_log(dt('Invalid filter option. Available options are: enabled, disabled, overridden, database, and code.'), 'error');
return;
@ -983,33 +993,42 @@ class shellColours {
'light_gray' => '47',
);
/**
* shellColours constructor.
*/
private function __construct() {}
// Returns coloured string
/**
* Returns coloured string.
*/
public static function getColouredOutput($string, $foreground_colour = NULL, $background_colour = NULL) {
$coloured_string = "";
// Check if given foreground colour found
// Check if given foreground colour found.
if ($foreground_colour) {
$coloured_string .= "\033[" . self::$foreground_colours[$foreground_colour] . "m";
}
// Check if given background colour found
// Check if given background colour found.
if ($background_colour) {
$coloured_string .= "\033[" . self::$background_colours[$background_colour] . "m";
}
// Add string and end colouring
$coloured_string .= $string . "\033[0m";
// Add string and end colouring.
$coloured_string .= $string . "\033[0m";
return $coloured_string;
}
// Returns all foreground colour names
/**
* Returns all foreground colour names.
*/
public static function getForegroundColours() {
return array_keys(self::$foreground_colours);
}
// Returns all background colour names
/**
* Returns all background colour names.
*/
public static function getBackgroundColours() {
return array_keys(self::$background_colours);
}

View File

@ -154,7 +154,7 @@ function mymodule_schema() {
<dd>Bulk export callback to provide a list of exportable objects to be chosen for bulk exporting. Defaults to $module . '_' . $table . '_list' if the function exists. If it is not, a default listing function will be provided that will make a best effort to list the titles. See ctools_export_default_list().</dd>
<dt>to hook code callback</dt>
<dd>Function used to generate an export for the bulk export process. This is only necessary if the export is more complicated than simply listing the fields. Defaults to $module . '_' . $table . '_to_hook_code'.</dt>
<dd>Function used to generate an export for the bulk export process. This is only necessary if the export is more complicated than simply listing the fields. Defaults to $module . '_' . $table . '_to_hook_code'.</dd>
<dt>boolean</dt>
<dd>Explicitly indicate if a table field contains a boolean or not. The Schema API does not model the

View File

@ -82,7 +82,7 @@ function ctools_modal_text_button($text, $dest, $alt, $class = '') {
<li> <strong>modalSize</strong>: an array of data to control the sizing of the modal. It can contain:
<ul>
<li> <strong>type</strong>: Either <em>fixed</em> or <em>scale</em>. If fixed, the modal will always be a fixed size. If <em>scale</em> the modal will scale to a percentage of the browser window. <em>Default: scale</em>.
<li> <strong>width</strong>: If </em>fixed</em> the width in pixels. If <em>scale</em> the percentage of the screen expressed as a number less than zero. (For 80 percent, use .8, for example). <em>Default: .8</em></li>
<li> <strong>width</strong>: If <em>fixed</em> the width in pixels. If <em>scale</em> the percentage of the screen expressed as a number less than zero. (For 80 percent, use .8, for example). <em>Default: .8</em></li>
<li> <strong>height</strong>: If <em>fixed</em> the height in pixels. If <em>scale</em> the percentage of the screen expressed as a number less than zero. (For 80 percent, use .8, for example). <em>Default: .8</em></li>
<li> <strong>addWidth</strong>: Any additional width to add to the modal in pixels. Only useful if the type is scale. <em>Default: 0</em></li>
<li> <strong>addHeight</strong>: Any additional height to add to the modal in pixels. Only useful if the type is scale. <em>Default: 0</em></li>
@ -168,7 +168,7 @@ function ctools_ajax_sample_login($js) {
<pre>
function ctools_ajax_hello_world($js) {
$title = t('Greetings');
$output = '&lt;p&gt;' . t('Hello world') . ''&lt;/p&gt;';
$output = '&lt;p&gt;' . t('Hello world') . '&lt;/p&gt;';
if ($js) {
ctools_modal_render($title, $output);
}

View File

@ -26,7 +26,7 @@ The following information can be specified for each plugin type:
<dd>If 'cache' is TRUE, then this value specifies the cache table where the cached plugin information will be stored.</dd>
<dt>classes</dt>
<dd><em>Defaults to:</em> <strong>array()</strong></dd>
<dd>An array of <em>class identifiers</em>(i.e. plugin array keys) which a plugin of this type uses to provide classes to the CTools autoloader. For example, if <strong>classes</strong> is set to array('class'), then CTools will search each <strong>$plugin['class']</strong> for a class to autoload. Depending of the plugin structure, a <em>class identifier</em> may be either:</dd>
<dd>An array of <em>class identifiers</em>(i.e. plugin array keys) which a plugin of this type uses to provide classes to the CTools autoloader. For example, if <strong>classes</strong> is set to array('class'), then CTools will search each <strong>$plugin['class']</strong> for a class to autoload. Depending of the plugin structure, a <em>class identifier</em> may be either:
<dl>
<dt>- a file name:</dt>
<dd>the file which holds the class with the name structure as: <em>[filename].[class].php</em></dd>
@ -35,6 +35,7 @@ The following information can be specified for each plugin type:
<dd>if the class is in the same file as the $plugin</dd>
<dd>the plugin <em>.inc</em> file can have a different name than the <em>class identifier</em></dd>
</dl>
<dd>
<dt>defaults</dt>
<dd><em>Defaults to:</em> <strong>array()</strong></dd>
<dd>An array of defaults that should be added to each plugin; this can be used to ensure that every plugin has the basic data necessary. These defaults will not ovewrite data supplied by the plugin. This could also be a function name, in which case the callback will be used to provide defaults. NOTE, however, that the callback-based approach is deprecated as it is redundant with the 'process' callback, and as such will be removed in later versions. Consequently, you should only use the array form for maximum cross-version compatibility.</dd>

View File

@ -1,4 +1,5 @@
<?php
/**
* @file
* Theme function for wrapping menu local actions.
@ -30,4 +31,4 @@ function theme_ctools_menu_local_actions_wrapper($variables) {
}
return '<ul class="action-links">' . $links . '</ul>';
}
}

View File

@ -1,6 +1,10 @@
<?php
// Set this so we can tell that the file has been included at some point.
/**
* @file
* Set this so we can tell that the file has been included at some point.
*/
define('CTOOLS_AJAX_INCLUDED', 1);
/**
@ -85,17 +89,17 @@ function ctools_ajax_icon_text_button($text, $image, $dest, $alt, $class = '', $
* @param $name
* The name or key: of the data attached to this selector.
* @param $value
* The value of the data.
* The value of the data.
*/
function ctools_ajax_command_attr($selector, $name, $value) {
ctools_add_js('ajax-responder');
return array(
'command' => 'attr',
'selector' => $selector,
'name' => $name,
'value' => $value,
);
}
'command' => 'attr',
'selector' => $selector,
'name' => $name,
'value' => $value,
);
}
/**
* Force a client-side redirect.
@ -154,4 +158,3 @@ function ctools_ajax_render_error($error = '') {
print ajax_render($commands);
exit;
}

View File

@ -2,7 +2,6 @@
/**
* @file
*
* Plugins to handle cache-indirection.
*
* Simple plugin management to allow clients to more tightly control where
@ -52,7 +51,6 @@
* @param string $mechanism
* A string containing the plugin name, and an optional data element to
* send to the plugin separated by two colons.
*
* @param string $key
* The key used to identify the cache.
*
@ -70,7 +68,6 @@ function ctools_cache_get($mechanism, $key) {
* @param string $mechanism
* A string containing the plugin name, and an optional data element to
* send to the plugin separated by two colons.
*
* @param string $key
* The key used to identify the cache.
*
@ -88,7 +85,6 @@ function ctools_cache_set($mechanism, $key, $object) {
* @param string $mechanism
* A string containing the plugin name, and an optional data element to
* send to the plugin separated by two colons.
*
* @param string $key
* The key used to identify the cache.
*/
@ -108,13 +104,10 @@ function ctools_cache_clear($mechanism, $key) {
* @param string $mechanism
* A string containing the plugin name, and an optional data element to
* send to the plugin separated by two colons.
*
* @param string $key
* The key used to identify the cache.
*
* @param string $op
* The operation to call, such as 'break' or 'finalize'.
*
* @param mixed $object
* The cache data being operated on, in case it is necessary. This is
* optional so no references should be used.
@ -150,7 +143,7 @@ function ctools_cache_operation($mechanism, $key, $op, $object = NULL) {
*/
function ctools_cache_find_plugin($mechanism) {
if (strpos($mechanism, '::') !== FALSE) {
// use explode(2) to ensure that the data can contain double
// Use explode(2) to ensure that the data can contain double
// colons, just in case.
list($name, $data) = explode('::', $mechanism, 2);
}

View File

@ -1,5 +1,4 @@
<?php
// $Id $
/**
* @file
@ -21,7 +20,7 @@
/**
* Matches Unicode character classes.
*
* See: http://www.unicode.org/Public/UNIDATA/UCD.html#General_Category_Values
* See: http://www.unicode.org/Public/UNIDATA/UCD.html#General_Category_Values.
*
* The index only contains the following character classes:
* Lu Letter, Uppercase
@ -129,13 +128,13 @@ function ctools_cleanstring($string, $settings = array()) {
$output = transliteration_get($output);
}
// Reduce to the subset of ASCII96 letters and numbers
// Reduce to the subset of ASCII96 letters and numbers.
if ($settings['reduce ascii']) {
$pattern = '/[^a-zA-Z0-9\/]+/';
$output = preg_replace($pattern, $settings['separator'], $output);
}
// Get rid of words that are on the ignore list
// Get rid of words that are on the ignore list.
if (!empty($settings['ignore words'])) {
$ignore_re = '\b' . preg_replace('/,/', '\b|\b', $settings['ignore words']) . '\b';
@ -159,14 +158,14 @@ function ctools_cleanstring($string, $settings = array()) {
else {
$seppattern = '\\' . $settings['separator'];
}
// Trim any leading or trailing separators (note the need to
// Trim any leading or trailing separators (note the need to.
$output = preg_replace("/^$seppattern+|$seppattern+$/", '', $output);
// Replace multiple separators with a single one
// Replace multiple separators with a single one.
$output = preg_replace("/$seppattern+/", $settings['separator'], $output);
}
// Enforce the maximum component length
// Enforce the maximum component length.
if (!empty($settings['max length'])) {
$output = ctools_cleanstring_truncate($output, $settings['max length'], $settings['separator']);
}
@ -188,12 +187,14 @@ function ctools_cleanstring($string, $settings = array()) {
* A string which contains the word boundary such as - or _.
*
* @return
* The string truncated below the maxlength.
* The string truncated below the maxlength.
*/
function ctools_cleanstring_truncate($string, $length, $separator) {
if (drupal_strlen($string) > $length) {
$string = drupal_substr($string, 0, $length + 1); // leave one more character
if ($last_break = strrpos($string, $separator)) { // space exists AND is not on position 0
// Leave one more character.
$string = drupal_substr($string, 0, $length + 1);
// Space exists AND is not on position 0.
if ($last_break = strrpos($string, $separator)) {
$string = substr($string, 0, $last_break);
}
else {

View File

@ -30,8 +30,8 @@ function ctools_collapsible_theme(&$items) {
* Text to put in the handle/title area of the div.
* @param $content
* Text to put in the content area of the div, this is what will get
* collapsed
* @param $collapsed = FALSE
* collapsed.
* @param $collapsed
* If true, this div will start out collapsed.
*/
function theme_ctools_collapsible($vars) {
@ -56,8 +56,8 @@ function theme_ctools_collapsible($vars) {
* Text to put in the handle/title area of the div.
* @param $content
* Text to put in the content area of the div, this is what will get
* collapsed
* @param $collapsed = FALSE
* collapsed.
* @param $collapsed
* If true, this div will start out collapsed.
*/
function theme_ctools_collapsible_remembered($vars) {
@ -76,4 +76,3 @@ function theme_ctools_collapsible_remembered($vars) {
return $output;
}

View File

@ -86,7 +86,7 @@ function ctools_content_process(&$plugin, $info) {
/**
* Fetch metadata on a specific content_type plugin.
*
* @param $content type
* @param mixed $content
* Name of a panel content type.
*
* @return
@ -146,7 +146,7 @@ function ctools_content_get_subtypes($type) {
if (is_array($function)) {
$subtypes = $function;
}
else if (function_exists($function)) {
elseif (function_exists($function)) {
// Cast to array to prevent errors from non-array returns.
$subtypes = (array) $function($plugin);
}
@ -157,7 +157,7 @@ function ctools_content_get_subtypes($type) {
foreach ($subtypes as $id => $subtype) {
// Ensure that the 'subtype_id' value exists.
if (!isset($subtype['subtype_id'])) {
$subtype['subtype_id'] = $id;
$subtypes[$id]['subtype_id'] = $id;
}
// Use exact name since this is a modify by reference.
@ -207,6 +207,13 @@ function ctools_content_get_subtype($type, $subtype_id) {
}
if ($subtype) {
// Ensure that the 'subtype_id' value exists. This is also done in
// ctools_content_get_subtypes(), but it wouldn't be called if the plugin
// provides the subtype through its own function.
if (!isset($subtype['subtype_id'])) {
$subtype['subtype_id'] = $subtype_id;
}
ctools_content_prepare_subtype($subtype, $plugin);
}
return $subtype;
@ -300,7 +307,7 @@ function ctools_content_render($type, $subtype, $conf, $keywords = array(), $arg
$content->subtype = $subtype;
}
// Override the title if configured to
// Override the title if configured to.
if (!empty($conf['override_title'])) {
// Give previous title as an available substitution here.
$keywords['%title'] = empty($content->title) ? '' : $content->title;
@ -310,12 +317,12 @@ function ctools_content_render($type, $subtype, $conf, $keywords = array(), $arg
}
if (!empty($content->title)) {
// Perform substitutions
// Perform substitutions.
if (!empty($keywords) || !empty($context)) {
$content->title = ctools_context_keyword_substitute($content->title, $keywords, $context);
}
// Sterilize the title
// Sterilize the title.
$content->title = filter_xss_admin($content->title);
// If a link is specified, populate.
@ -326,7 +333,7 @@ function ctools_content_render($type, $subtype, $conf, $keywords = array(), $arg
else {
$url = $content->title_link;
}
// set defaults so we don't bring up notices
// Set defaults so we don't bring up notices.
$url += array('href' => '', 'attributes' => array(), 'query' => array(), 'fragment' => '', 'absolute' => NULL, 'html' => TRUE);
$content->title = l($content->title, $url['href'], $url);
}
@ -348,7 +355,7 @@ function ctools_content_editable($type, $subtype, $conf) {
}
$function = FALSE;
if (!empty($subtype['check editable'])) {
$function = ctools_plugin_get_function($subtype, 'check editable');
}
@ -379,7 +386,7 @@ function ctools_content_admin_title($type, $subtype, $conf, $context = NULL) {
if (is_array($type)) {
$plugin = $type;
}
else if (is_string($type)) {
elseif (is_string($type)) {
$plugin = ctools_get_content_type($type);
}
else {
@ -397,10 +404,10 @@ function ctools_content_admin_title($type, $subtype, $conf, $context = NULL) {
return $function($subtype, $conf, $pane_context);
}
else if (isset($plugin['admin title'])) {
elseif (isset($plugin['admin title'])) {
return $plugin['admin title'];
}
else if (isset($plugin['title'])) {
elseif (isset($plugin['title'])) {
return $plugin['title'];
}
}
@ -435,7 +442,7 @@ function ctools_content_get_defaults($plugin, $subtype) {
if (isset($plugin['defaults'])) {
$defaults = $plugin['defaults'];
}
else if (isset($subtype['defaults'])) {
elseif (isset($subtype['defaults'])) {
$defaults = $subtype['defaults'];
}
if (isset($defaults)) {
@ -444,7 +451,7 @@ function ctools_content_get_defaults($plugin, $subtype) {
return $return;
}
}
else if (is_array($defaults)) {
elseif (is_array($defaults)) {
return $defaults;
}
}
@ -478,7 +485,7 @@ function ctools_content_admin_info($type, $subtype, $conf, $context = NULL) {
if (empty($output) || !is_object($output)) {
$output = new stdClass();
// replace the _ with " " for a better output
// Replace the _ with " " for a better output.
$subtype = check_plain(str_replace("_", " ", $subtype));
$output->title = $subtype;
$output->content = t('No info available.');
@ -487,7 +494,7 @@ function ctools_content_admin_info($type, $subtype, $conf, $context = NULL) {
}
/**
* Add the default FAPI elements to the content type configuration form
* Add the default FAPI elements to the content type configuration form.
*/
function ctools_content_configure_form_defaults($form, &$form_state) {
$plugin = $form_state['plugin'];
@ -604,7 +611,7 @@ function ctools_content_form($op, $form_info, &$form_state, $plugin, $subtype_na
if (!empty($subtype['add form'])) {
_ctools_content_create_form_info($form_info, $subtype['add form'], $subtype, $subtype, $op);
}
else if (!empty($plugin['add form'])) {
elseif (!empty($plugin['add form'])) {
_ctools_content_create_form_info($form_info, $plugin['add form'], $plugin, $subtype, $op);
}
}
@ -614,7 +621,7 @@ function ctools_content_form($op, $form_info, &$form_state, $plugin, $subtype_na
if (!empty($subtype['edit form'])) {
_ctools_content_create_form_info($form_info, $subtype['edit form'], $subtype, $subtype, $op);
}
else if (!empty($plugin['edit form'])) {
elseif (!empty($plugin['edit form'])) {
_ctools_content_create_form_info($form_info, $plugin['edit form'], $plugin, $subtype, $op);
}
}
@ -633,7 +640,7 @@ function _ctools_content_create_form_info(&$form_info, $info, $plugin, $subtype,
if (empty($subtype['title'])) {
$title = t('Configure');
}
else if ($op == 'add') {
elseif ($op == 'add') {
$title = t('Configure new !subtype_title', array('!subtype_title' => $subtype['title']));
}
else {
@ -648,7 +655,7 @@ function _ctools_content_create_form_info(&$form_info, $info, $plugin, $subtype,
),
);
}
else if (is_array($info)) {
elseif (is_array($info)) {
$form_info['order'] = array();
$form_info['forms'] = array();
$count = 0;
@ -699,7 +706,7 @@ function ctools_content_get_available_types($contexts = NULL, $has_content = FAL
foreach ($plugins as $id => $plugin) {
foreach (ctools_content_get_subtypes($plugin) as $subtype_id => $subtype) {
// exclude items that require content if we're saying we don't
// Exclude items that require content if we're saying we don't
// provide it.
if (!empty($subtype['requires content']) && !$has_content) {
continue;
@ -739,7 +746,6 @@ function ctools_content_get_available_types($contexts = NULL, $has_content = FAL
* Get an array of all content types that can be fed into the
* display editor for the add content list, regardless of
* availability.
*
*/
function ctools_content_get_all_types() {
$plugins = ctools_get_content_types();

View File

@ -62,9 +62,8 @@ function ctools_content_autocomplete_entity($entity_type, $string = '') {
}
}
/*
* Use well known/tested entity reference code to build our search query
* From EntityReference_SelectionHandler_Generic class
/**
* Use EntityReference_SelectionHandler_Generic class to build our search query.
*/
function _ctools_buildQuery($entity_type, $entity_info, $match = NULL, $match_operator = 'CONTAINS') {
$base_table = $entity_info['base table'];
@ -92,13 +91,13 @@ function _ctools_buildQuery($entity_type, $entity_info, $match = NULL, $match_op
if ($entity_type == 'comment') {
// Adding the 'comment_access' tag is sadly insufficient for comments: core
// requires us to also know about the concept of 'published' and
// 'unpublished'.
// 'unpublished'.
if (!user_access('administer comments')) {
$query->condition('comment.status', COMMENT_PUBLISHED);
}
// Join to a node if the user does not have node access bypass permissions
// to obey node published permissions
// to obey node published permissions.
if (!user_access('bypass node access')) {
$node_alias = $query->innerJoin('node', 'n', '%alias.nid = comment.nid');
$query->condition($node_alias . '.status', NODE_PUBLISHED);
@ -125,7 +124,7 @@ function _ctools_getReferencableEntities($entity_type, $entity_info, $match = NU
global $user;
$account = $user;
$options = array();
// We're an entity ID, return the id
// We're an entity ID, return the id.
if (is_numeric($match) && $match_operator == '=') {
if ($entity = array_shift(entity_load($entity_type, array($match)))) {
if (isset($entity_info['access callback']) && function_exists($entity_info['access callback'])) {
@ -143,10 +142,10 @@ function _ctools_getReferencableEntities($entity_type, $entity_info, $match = NU
// If you don't have access, or an access callback or a valid entity, just
// Return back the Entity ID.
return array(
$match => array(
$match => array(
'label' => $match,
'bundle' => NULL,
),
),
);
}

View File

@ -14,4 +14,4 @@ function ctools_content_plugin_type(&$items) {
'path' => drupal_get_path('module', 'ctools') . '/includes',
),
);
}
}

View File

@ -245,10 +245,10 @@ function ctools_access_admin_form_submit($form, &$form_state) {
// --------------------------------------------------------------------------
// AJAX menu entry points.
/**
* AJAX callback to add a new access test to the list.
*/
function ctools_access_ajax_add($fragment = NULL, $name = NULL) {
ctools_include('ajax');
ctools_include('modal');
@ -263,7 +263,7 @@ function ctools_access_ajax_add($fragment = NULL, $name = NULL) {
ctools_ajax_render_error();
}
// Separate the fragment into 'module' and 'argument'
// Separate the fragment into 'module' and 'argument'.
if (strpos($fragment, '-') === FALSE) {
$module = $fragment;
$argument = NULL;
@ -279,7 +279,7 @@ function ctools_access_ajax_add($fragment = NULL, $name = NULL) {
list($access, $contexts) = $function($argument);
// Make sure we have the logged in user context
// Make sure we have the logged in user context.
if (!isset($contexts['logged-in-user'])) {
$contexts['logged-in-user'] = ctools_access_get_loggedin_context();
}
@ -306,6 +306,9 @@ function ctools_access_ajax_add($fragment = NULL, $name = NULL) {
);
$output = ctools_modal_form_wrapper('ctools_access_ajax_edit_item', $form_state);
$access = $form_state['access'];
$access['plugins'][$id] = $form_state['test'];
if (!isset($output[0])) {
$function = $module . '_ctools_access_set';
if (function_exists($function)) {
@ -333,7 +336,7 @@ function ctools_access_ajax_edit($fragment = NULL, $id = NULL) {
ctools_ajax_render_error();
}
// Separate the fragment into 'module' and 'argument'
// Separate the fragment into 'module' and 'argument'.
if (strpos($fragment, '-') === FALSE) {
$module = $fragment;
$argument = NULL;
@ -353,7 +356,7 @@ function ctools_access_ajax_edit($fragment = NULL, $id = NULL) {
ctools_ajax_render_error();
}
// Make sure we have the logged in user context
// Make sure we have the logged in user context.
if (!isset($contexts['logged-in-user'])) {
$contexts['logged-in-user'] = ctools_access_get_loggedin_context();
}
@ -372,6 +375,9 @@ function ctools_access_ajax_edit($fragment = NULL, $id = NULL) {
);
$output = ctools_modal_form_wrapper('ctools_access_ajax_edit_item', $form_state);
$access = $form_state['access'];
$access['plugins'][$id] = $form_state['test'];
if (!isset($output[0])) {
$function = $module . '_ctools_access_set';
if (function_exists($function)) {
@ -451,7 +457,7 @@ function ctools_access_ajax_delete($fragment = NULL, $id = NULL) {
ajax_render_error();
}
// Separate the fragment into 'module' and 'argument'
// Separate the fragment into 'module' and 'argument'.
if (strpos($fragment, '-') === FALSE) {
$module = $fragment;
$argument = NULL;
@ -471,7 +477,7 @@ function ctools_access_ajax_delete($fragment = NULL, $id = NULL) {
unset($access['plugins'][$id]);
}
// re-cache
// re-cache.
$function = $module . '_ctools_access_set';
if (function_exists($function)) {
$function($argument, $access);

View File

@ -395,7 +395,7 @@ function ctools_context_ajax_item_add($mechanism = NULL, $type = NULL, $cache_ke
if (!empty($form_state['cancel'])) {
$output = array(ctools_modal_command_dismiss());
}
else if (!empty($form_state['complete'])) {
elseif (!empty($form_state['complete'])) {
// Successful submit -- move temporary data to location.
// Create a reference to the place our context lives. Since this is fairly
@ -580,7 +580,7 @@ function ctools_context_ajax_item_edit($mechanism = NULL, $type = NULL, $cache_k
if (!empty($form_state['cancel'])) {
$output = array(ctools_modal_command_dismiss());
}
else if (!empty($form_state['complete'])) {
elseif (!empty($form_state['complete'])) {
// successful submit
$ref[$position] = $conf;
if (isset($object->temporary)) {
@ -657,7 +657,7 @@ function ctools_context_get_defaults($plugin_definition, $object, $type) {
if (isset($plugin_definition['defaults'])) {
$defaults = $plugin_definition['defaults'];
}
else if (isset($subtype['defaults'])) {
elseif (isset($subtype['defaults'])) {
$defaults = $subtype['defaults'];
}
@ -667,7 +667,7 @@ function ctools_context_get_defaults($plugin_definition, $object, $type) {
$conf += $settings;
}
}
else if (is_array($defaults)) {
elseif (is_array($defaults)) {
$conf += $defaults;
}
}

View File

@ -4,9 +4,9 @@
* @file
* Support for creating 'context' type task handlers.
*
* Context task handlers expect the task to provide 0 or more contexts. The
* task handler should use those contexts as selection rules, as well as
* rendering with them.
* Context task handlers expect the task to provide 0 or more contexts. The task
* handler should use those contexts as selection rules, as well as rendering
* with them.
*
* The functions and forms in this file should be common to every context type
* task handler made.
@ -31,6 +31,7 @@
* If TRUE then this renderer owns the page and can use theme('page')
* for no blocks; if false, output is returned regardless of any no
* blocks settings.
*
* @return
* Either the output or NULL if there was output, FALSE if no handler
* accepted the task. If $page is FALSE then the $info block is returned instead.
@ -84,7 +85,7 @@ function ctools_context_handler_get_render_handler($task, $subtask, $handlers, $
*/
function ctools_context_handler_default_test($handler, $base_contexts, $args) {
ctools_include('context');
// Add my contexts
// Add my contexts.
$contexts = ctools_context_handler_get_handler_contexts($base_contexts, $handler);
// Test.
@ -128,7 +129,7 @@ function ctools_context_handler_render_handler($task, $subtask, $handler, $conte
'contexts' => $contexts,
'task' => $task,
'subtask' => $subtask,
'handler' => $handler
'handler' => $handler,
);
drupal_alter('ctools_render', $info, $page, $context);
@ -141,12 +142,15 @@ function ctools_context_handler_render_handler($task, $subtask, $handler, $conte
switch ($info['response code']) {
case 403:
return MENU_ACCESS_DENIED;
case 404:
return MENU_NOT_FOUND;
case 410:
drupal_add_http_header('Status', '410 Gone');
drupal_exit();
break;
case 301:
case 302:
case 303:
@ -162,7 +166,7 @@ function ctools_context_handler_render_handler($task, $subtask, $handler, $conte
'fragment' => $info['fragment'],
);
drupal_goto($info['destination'], $options, $info['response code']);
// @todo -- should other response codes be supported here?
// @todo -- should other response codes be supported here?
}
}
@ -222,7 +226,7 @@ function ctools_context_handler_render_handler($task, $subtask, $handler, $conte
}
/**
* Default function to provide contextual link for a task as defined by the handler.
* Provides contextual link for a task as defined by the handler.
*
* This provides a simple link to th main content operation and is suitable
* for most normal handlers. Setting 'contextual link' to a function overrides
@ -241,7 +245,7 @@ function ctools_task_handler_default_contextual_link($handler, $plugin, $context
if (is_array($plugin['tab operation'])) {
$trail = $plugin['tab operation'];
}
else if (function_exists($plugin['tab operation'])) {
elseif (function_exists($plugin['tab operation'])) {
$trail = $plugin['tab operation']($handler, $contexts, $args);
}
}
@ -251,7 +255,8 @@ function ctools_task_handler_default_contextual_link($handler, $plugin, $context
'href' => $path,
'title' => $title,
'query' => drupal_get_destination(),
));
),
);
return $links;
}
@ -259,17 +264,22 @@ function ctools_task_handler_default_contextual_link($handler, $plugin, $context
/**
* Called to execute actions that should happen before a handler is rendered.
*/
function ctools_context_handler_pre_render($handler, $contexts, $args) { }
function ctools_context_handler_pre_render($handler, $contexts, $args) {
foreach (module_implements('ctools_context_handler_pre_render') as $module) {
$function = $module . '_ctools_context_handler_pre_render';
$function($handler, $contexts, $args);
}
}
/**
* Compare arguments to contexts for selection purposes.
*
* @param $handler
* @param object $handler
* The handler in question.
* @param $contexts
* @param object $contexts
* The context objects provided by the task.
*
* @return
* @return bool
* TRUE if these contexts match the selection rules. NULL or FALSE
* otherwise.
*/
@ -288,12 +298,15 @@ function ctools_context_handler_select($handler, $contexts) {
* These summary strings are used to communicate to the user what
* arguments the task handlers are selecting.
*
* @param $task
* @param object $task
* The loaded task plugin.
* @param $subtask
* @param object $subtask
* The subtask id.
* @param $handler
* @param object $handler
* The handler to be checked.
*
* @return array
* Returns array of summary strings for arguments selected by task handlers.
*/
function ctools_context_handler_summary($task, $subtask, $handler) {
if (empty($handler->conf['access']['plugins'])) {
@ -320,7 +333,6 @@ function ctools_context_handler_summary($task, $subtask, $handler) {
// the task handler, for example) but sometimes we need them separately
// (when a task has contexts loaded and is trying out the task handlers,
// for example). Therefore there are two paths we can take to getting contexts.
/**
* Load the contexts for a task, using arguments.
*
@ -368,7 +380,7 @@ function ctools_context_handler_get_all_contexts($task, $subtask, $handler) {
* expects things in a certain, kind of clunky format.
*/
function ctools_context_handler_get_handler_object($handler) {
$object = new stdClass;
$object = new stdClass();
$object->name = $handler->name;
$object->contexts = isset($handler->conf['contexts']) ? $handler->conf['contexts'] : array();
$object->relationships = isset($handler->conf['relationships']) ? $handler->conf['relationships'] : array();
@ -382,7 +394,7 @@ function ctools_context_handler_get_handler_object($handler) {
* arguments from the task.
*/
function ctools_context_handler_get_task_object($task, $subtask, $handler) {
$object = new stdClass;
$object = new stdClass();
$object->name = !empty($handler->name) ? $handler->name : 'temp';
$object->base_contexts = ctools_context_handler_get_base_contexts($task, $subtask, TRUE);
$object->arguments = ctools_context_handler_get_task_arguments($task, $subtask);
@ -456,7 +468,7 @@ function ctools_context_handler_edit_criteria($form, &$form_state) {
ctools_modal_add_plugin_js(ctools_get_access_plugins());
ctools_include('context-access-admin');
$form_state['module'] = (isset($form_state['module'])) ? $form_state['module'] : 'page_manager_task_handler';
// Encode a bunch of info into the argument so we can get our cache later
// Encode a bunch of info into the argument so we can get our cache later.
$form_state['callback argument'] = $form_state['task_name'] . '*' . $form_state['handler']->name;
$form_state['access'] = $form_state['handler']->conf['access'];
$form_state['no buttons'] = TRUE;
@ -472,7 +484,7 @@ function ctools_context_handler_edit_criteria($form, &$form_state) {
}
/**
* Submit handler for rules selection
* Submit handler for rules selection.
*/
function ctools_context_handler_edit_criteria_submit(&$form, &$form_state) {
$form_state['handler']->conf['access']['logic'] = $form_state['values']['logic'];
@ -537,4 +549,3 @@ function ctools_context_handler_edit_context_submit(&$form, &$form_state) {
unset($form_state['page']->context_cache[$cache_name]);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -25,7 +25,7 @@ function ctools_context_menu(&$items) {
'page callback' => 'ctools_context_ajax_item_delete',
) + $base;
// For the access system
// For the access system.
$base['file'] = 'includes/context-access-admin.inc';
$items['ctools/context/ajax/access/add'] = array(
'page callback' => 'ctools_access_ajax_add',

View File

@ -19,7 +19,6 @@ function ctools_context_theme(&$theme) {
);
$theme['ctools_context_item_form'] = array(
'render element' => 'form',
// 'variables' => array('form' => NULL),
'file' => 'includes/context.theme.inc',
);
$theme['ctools_context_item_row'] = array(
@ -27,7 +26,7 @@ function ctools_context_theme(&$theme) {
'file' => 'includes/context.theme.inc',
);
// For the access plugin
// For the access plugin.
$theme['ctools_access_admin_add'] = array(
'render element' => 'form',
'file' => 'includes/context-access-admin.inc',
@ -62,10 +61,10 @@ function theme_ctools_context_item_row($vars) {
function theme_ctools_context_item_form($vars) {
$form = $vars['form'];
$output = '';
$type = $form['#ctools_context_type'];
$module = $form['#ctools_context_module'];
$cache_key = $form['#cache_key'];
$output = '';
$type = $form['#ctools_context_type'];
$module = $form['#ctools_context_module'];
$cache_key = $form['#cache_key'];
$type_info = ctools_context_info($type);
@ -104,17 +103,17 @@ function theme_ctools_context_item_form($vars) {
if (!empty($form['buttons'])) {
// Display the add context item.
$row = array();
$row[] = array('data' => render($form['buttons'][$type]['item']), 'class' => array('title'));
$row[] = array('data' => render($form['buttons'][$type]['add']), 'class' => array('add'), 'width' => "60%");
$output .= '<div class="buttons">';
$output .= render($form['buttons'][$type]);
$theme_vars = array();
$theme_vars['header'] = array();
$theme_vars['rows'] = array($row);
$row = array();
$row[] = array('data' => render($form['buttons'][$type]['item']), 'class' => array('title'));
$row[] = array('data' => render($form['buttons'][$type]['add']), 'class' => array('add'), 'width' => "60%");
$output .= '<div class="buttons">';
$output .= render($form['buttons'][$type]);
$theme_vars = array();
$theme_vars['header'] = array();
$theme_vars['rows'] = array($row);
$theme_vars['attributes'] = array('id' => $type . '-add-table');
$output .= theme('table', $theme_vars);
$output .= '</div>';
$output .= theme('table', $theme_vars);
$output .= '</div>';
}
if (!empty($form['description'])) {
$output .= render($form['description']);
@ -139,7 +138,7 @@ function theme_ctools_context_list($vars) {
$description = (!empty($vars['description'])) ? $vars['description'] : NULL;
$titles = array();
$output = '';
$count = 1;
$count = 1;
$contexts = ctools_context_load_contexts($object);
@ -209,7 +208,7 @@ function theme_ctools_context_list($vars) {
}
}
// And relationships
// And relationships.
if (!empty($object->relationships)) {
foreach ($object->relationships as $relationship) {
$output .= '<tr>';
@ -253,15 +252,15 @@ function theme_ctools_context_list($vars) {
}
/**
* ctools_context_list() but not in a table format because tabledrag
* won't let us have tables within tables and still drag.
* The ctools_context_list() function but not in a table format because
* tabledrag won't let us have tables within tables and still drag.
*/
function theme_ctools_context_list_no_table($vars) {
$object = $vars['object'];
ctools_add_css('context');
$titles = array();
$output = '';
$count = 1;
$count = 1;
// Describe 'built in' contexts.
if (!empty($object->base_contexts)) {
foreach ($object->base_contexts as $id => $context) {
@ -312,7 +311,7 @@ function theme_ctools_context_list_no_table($vars) {
$count++;
}
}
// And relationships
// And relationships.
if (!empty($object->relationships)) {
foreach ($object->relationships as $relationship) {
$output .= '<div class="ctools-context-holder clearfix">';
@ -341,4 +340,3 @@ function theme_ctools_context_list_no_table($vars) {
return $output;
}

View File

@ -1,6 +1,6 @@
<?php
/*
/**
* @file
* CSS filtering functions. Contains a disassembler, filter, compressor, and
* decompressor.
@ -149,11 +149,11 @@ function ctools_css_clear($id) {
*
* @param $css
* A chunk of well-formed CSS text to cache.
* @param $filter
* @param bool $filter
* If TRUE the css will be filtered. If FALSE the text will be cached
* as-is.
*
* @return $filename
* @return string
* The filename the CSS will be cached in.
*/
function ctools_css_cache($css, $filter = TRUE) {
@ -164,7 +164,6 @@ function ctools_css_cache($css, $filter = TRUE) {
// Create the css/ within the files folder.
$path = 'public://ctools/css';
if (!file_prepare_directory($path, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) {
// if (!file_prepare_directory($path, FILE_CREATE_DIRECTORY)) {
drupal_set_message(t('Unable to create CTools CSS cache directory. Check the permissions on your files directory.'), 'error');
return;
}
@ -213,7 +212,7 @@ function ctools_css_filter($css, $compressed = TRUE) {
* An array of css data, as produced by @see ctools_css_disassemble()
* disassembler and the @see ctools_css_filter_css_data() filter.
*
* @return string $css
* @return string
* css optimized for human viewing.
*/
function ctools_css_assemble($css_data) {
@ -243,7 +242,7 @@ function ctools_css_assemble($css_data) {
* An array of css data, as produced by @see ctools_css_disassemble()
* disassembler and the @see ctools_css_filter_css_data() filter.
*
* @return string $css
* @return string
* css optimized for use.
*/
function ctools_css_compress($css_data) {
@ -279,7 +278,7 @@ function ctools_css_compress($css_data) {
* @param string $css
* A string containing the css to be disassembled.
*
* @return array $disassembled_css
* @return array
* An array of disassembled, slightly cleaned-up/formatted css statements.
*/
function ctools_css_disassemble($css) {
@ -385,7 +384,6 @@ function _ctools_css_disassemble_declaration($declaration) {
* An array of disassembled, filtered CSS.
*/
function ctools_css_filter_css_data($css, $allowed_properties = array(), $allowed_values = array(), $allowed_values_regex = '', $disallowed_values_regex = '') {
//function ctools_css_filter_css_data($css, &$filtered = NULL, $allowed_properties = array(), $allowed_values = array(), $allowed_values_regex = '', $disallowed_values_regex = '') {
// Retrieve the default list of allowed properties if none is provided.
$allowed_properties = !empty($allowed_properties) ? $allowed_properties : ctools_css_filter_default_allowed_properties();
// Retrieve the default list of allowed values if none is provided.
@ -393,19 +391,18 @@ function ctools_css_filter_css_data($css, $allowed_properties = array(), $allowe
// Define allowed values regex if none is provided.
$allowed_values_regex = !empty($allowed_values_regex) ? $allowed_values_regex : '/(#[0-9a-f]+|rgb\(\d+%?,\d*%?,?\d*%?\)?|\d{0,2}\.?\d{0,2}(cm|em|ex|in|mm|pc|pt|px|%|,|\))?)/';
// Define disallowed url() value contents, if none is provided.
// $disallowed_values_regex = !empty($disallowed_values_regex) ? $disallowed_values_regex : '/[url|expression]\s*\(\s*[^\s)]+?\s*\)\s*/';
$disallowed_values_regex = !empty($disallowed_values_regex) ? $disallowed_values_regex : '/(url|expression)/';
foreach ($css as $selector_str => $declaration) {
foreach ($declaration as $property => $value) {
if (!in_array($property, $allowed_properties)) {
// $filtered['properties'][$selector_str][$property] = $value;
// $filtered['properties'][$selector_str][$property] = $value;.
unset($css[$selector_str][$property]);
continue;
}
$value = str_replace('!important', '', $value);
if (preg_match($disallowed_values_regex, $value) || !(in_array($value, $allowed_values) || preg_match($allowed_values_regex, $value))) {
// $filtered['values'][$selector_str][$property] = $value;
// $filtered['values'][$selector_str][$property] = $value;.
unset($css[$selector_str][$property]);
continue;
}

View File

@ -44,7 +44,7 @@
*
* A fuller example, that hides the menu title when no menu is selected:
* @code
*function ctools_dependent_example() {
* function ctools_dependent_example() {
* $form = array();
* $form['menu'] = array(
* '#type' => 'fieldset',
@ -72,12 +72,12 @@
* );
*
* return system_settings_form($form);
*}
* }
* @endcode
*
* An example for hiding checkboxes using #prefix and #suffix:
* @code
*function ctools_dependent_example_checkbox() {
* function ctools_dependent_example_checkbox() {
* $form = array();
* $form['object'] = array(
* '#type' => 'fieldset',
@ -111,7 +111,7 @@
* );
*
* return system_settings_form($form);
*}
* }
* @endcode
*
* Deprecated:
@ -125,7 +125,6 @@
/**
* Process callback to add dependency to form items.
*
*/
function ctools_dependent_process($element, &$form_state, &$form) {
return $element;

View File

@ -75,7 +75,7 @@ function theme_links__ctools_dropbutton($vars) {
if (!empty($vars['links'])) {
$is_drop_button = (count($vars['links']) > 1);
// Add needed files
// Add needed files.
if ($is_drop_button) {
ctools_add_js('dropbutton');
ctools_add_css('dropbutton');
@ -86,7 +86,7 @@ function theme_links__ctools_dropbutton($vars) {
static $id = 0;
$id++;
// Wrapping div
// Wrapping div.
$class = 'ctools-no-js';
$class .= ($is_drop_button) ? ' ctools-dropbutton' : '';
$class .= ' ctools-button';
@ -98,21 +98,22 @@ function theme_links__ctools_dropbutton($vars) {
$output .= '<div class="' . $class . '" id="ctools-button-' . $id . '">';
// Add a twisty if this is a dropbutton
// Add a twisty if this is a dropbutton.
if ($is_drop_button) {
$vars['title'] = ($vars['title'] ? check_plain($vars['title']) : t('open'));
$output .= '<div class="ctools-link">';
if ($vars['image']) {
$output .= '<a href="#" class="ctools-twisty ctools-image">' . $vars['title'] . '</a>';
$output .= '<a href="#" class="ctools-twisty ctools-image"><span class="element-invisible">' . $vars['title'] . '</span></a>';
}
else {
$output .= '<a href="#" class="ctools-twisty ctools-text">' . $vars['title'] . '</a>';
$output .= '<a href="#" class="ctools-twisty ctools-text"><span class="element-invisible">' . $vars['title'] . '</span></a>';
}
$output .= '</div>'; // ctools-link
// ctools-link.
$output .= '</div>';
}
// The button content
// The button content.
$output .= '<div class="ctools-content">';
// Check for attributes. theme_links expects an array().
@ -132,12 +133,11 @@ function theme_links__ctools_dropbutton($vars) {
// Call theme_links to render the list of links.
$output .= theme_links(array('links' => $vars['links'], 'attributes' => $vars['attributes'], 'heading' => ''));
$output .= '</div>'; // ctools-content
$output .= '</div>'; // ctools-dropbutton
$output .= '</div>'; // ctools-content.
$output .= '</div>'; // ctools-dropbutton.
return $output;
}
else {
return '';
}
}

View File

@ -44,20 +44,21 @@ function ctools_dropdown_theme(&$items) {
/**
* Create a dropdown menu.
*
* @param $title
* The text to place in the clickable area to activate the dropdown.
* @param $links
* A list of links to provide within the dropdown, suitable for use
* in via Drupal's theme('links').
* @param $image
* If true, the dropdown link is an image and will not get extra decorations
* that a text dropdown link will.
* @param $class
* An optional class to add to the dropdown's container div to allow you
* to style a single dropdown however you like without interfering with
* other dropdowns.
* @param array $variables
* An associative array containing:
* - title: The text to place in the clickable area to activate the dropdown.
* - links: A list of links to provide within the dropdown, suitable for use
* in via Drupal's theme('links').
* - image: If true, the dropdown link is an image and will not get extra
* decorations that a text dropdown link will.
* - class: An optional class to add to the dropdown's container div to allow
* you to style a single dropdown however you like without interfering with
* other dropdowns.
*
* @return string
* Returns HTML for a language configuration form.
*/
function theme_ctools_dropdown($vars) {
function theme_ctools_dropdown($vars) {
// Provide a unique identifier for every dropdown on the page.
static $id = 0;
$id++;
@ -67,9 +68,7 @@ function theme_ctools_dropdown($vars) {
ctools_add_js('dropdown');
ctools_add_css('dropdown');
$output = '';
$output .= '<div class="' . $class . '" id="ctools-dropdown-' . $id . '">';
$output = '<div class="' . $class . '" id="ctools-dropdown-' . $id . '">';
$output .= '<div class="ctools-dropdown-link-wrapper">';
if ($vars['image']) {
$output .= '<a href="#" class="ctools-dropdown-link ctools-dropdown-image-link">' . $vars['title'] . '</a>';
@ -77,14 +76,13 @@ function theme_ctools_dropdown($vars) {
else {
$output .= '<a href="#" class="ctools-dropdown-link ctools-dropdown-text-link">' . check_plain($vars['title']) . '</a>';
}
$output .= '</div>'; // wrapper
$output .= '</div>';
$output .= '<div class="ctools-dropdown-container-wrapper">';
$output .= '<div class="ctools-dropdown-container">';
$output .= theme_links(array('links' => $vars['links'], 'attributes' => array(), 'heading' => ''));
$output .= '</div>'; // container
$output .= '</div>'; // container wrapper
$output .= '</div>'; // dropdown
$output .= '</div>';
$output .= '</div>';
$output .= '</div>';
return $output;
}

View File

@ -24,19 +24,23 @@ function _ctools_entity_access(&$entity_info, $entity_type) {
// Sad panda, we don't use Entity API, lets manually add access callbacks.
$entity_info['access callback'] = 'ctools_metadata_no_hook_node_access';
break;
case 'user':
$entity_info['access callback'] = 'ctools_metadata_user_access';
break;
case 'comment':
if (module_exists('comment')) {
$entity_info['access callback'] = 'ctools_metadata_comment_access';
}
break;
case 'taxonomy_term':
if (module_exists('taxonomy')) {
$entity_info['access callback'] = 'ctools_metadata_taxonomy_access';
}
break;
case 'taxonomy_vocabulary':
if (module_exists('taxonomy')) {
$entity_info['access callback'] = 'ctools_metadata_taxonomy_access';
@ -64,7 +68,7 @@ function _ctools_entity_access(&$entity_info, $entity_type) {
*
* @throws EntityMalformedException
*
* @return boolean
* @return bool
* TRUE if access is allowed, FALSE otherwise.
*/
function ctools_metadata_no_hook_node_access($op, $node = NULL, $account = NULL) {

View File

@ -81,7 +81,6 @@ function ctools_export_ui_process(&$plugin, $info) {
// Add some default fields that appear often in exports
// If these use different keys they can easily be specified in the
// $plugin.
if (empty($plugin['export']['admin_title']) && !empty($schema['fields']['admin_title'])) {
$plugin['export']['admin_title'] = 'admin_title';
}
@ -297,7 +296,6 @@ function ctools_export_ui_process(&$plugin, $info) {
);
// Define strings.
// For all strings, %title may be filled in at a later time via str_replace
// since we do not know the title now.
$plugin['strings'] += array(
@ -335,7 +333,7 @@ function ctools_export_ui_process(&$plugin, $info) {
$plugin['strings']['confirmation']['delete'] += array(
'question' => t('Are you sure you want to delete %title?'),
'information' => t('This action will permanently remove this item from your database..'),
'information' => t('This action will permanently remove this item from your database.'),
'success' => t('The item has been deleted.'),
);
@ -414,6 +412,7 @@ function ctools_export_ui_plugin_base_path($plugin) {
* The id in the menu items from the plugin.
* @param $export_key
* The export key of the item being edited, if it exists.
*
* @return
* The menu path to the plugin's list.
*/
@ -429,12 +428,11 @@ function ctools_export_ui_plugin_menu_path($plugin, $item_id, $export_key = NULL
* Helper function to include CTools plugins and get an export-ui exportable.
*
* @param $plugin_name
* The plugin that should be laoded.
* The plugin that should be loaded.
*/
function ctools_get_export_ui($plugin_name) {
ctools_include('plugins');
return ctools_get_plugins('ctools', 'export_ui', $plugin_name);
}
/**
@ -456,14 +454,14 @@ function ctools_export_ui_switcher_page($plugin_name, $op) {
$args = func_get_args();
$js = !empty($_REQUEST['js']);
// Load the $plugin information
// Load the $plugin information.
$plugin = ctools_get_export_ui($plugin_name);
$handler = ctools_export_ui_get_handler($plugin);
if ($handler) {
$method = $op . '_page';
if (method_exists($handler, $method)) {
// replace the first two arguments:
// Replace the first two arguments:
$args[0] = $js;
$args[1] = $_POST;
return call_user_func_array(array($handler, $method), $args);

View File

@ -1,5 +1,9 @@
<?php
/**
* @file
*/
/**
* Delegated implementation of hook_menu().
*/

View File

@ -17,4 +17,4 @@ function ctools_export_ui_plugin_type(&$items) {
),
'classes' => array('handler'),
);
}
}

View File

@ -4,7 +4,7 @@
* @file
* Contains code to make it easier to have exportable objects.
*
* Documentation for exportable objects is contained in help/export.html
* Documentation for exportable objects is contained in help/export.html.
*/
/**
@ -126,6 +126,7 @@ function ctools_export_crud_load_multiple($table, array $names) {
* If TRUE, the static cache of all objects will be flushed prior to
* loading all. This can be important on listing pages where items
* might have changed on the page load.
*
* @return
* An array of all loaded objects, keyed by the unique IDs of the export key.
*/
@ -328,7 +329,6 @@ function ctools_export_crud_set_status($table, $object, $status) {
}
/**
* Enable a certain object.
*
@ -426,7 +426,7 @@ function ctools_export_load_object($table, $type = 'all', $args = array()) {
}
}
// Build the query
// Build the query.
$query = db_select($table, 't__0')->fields('t__0');
$alias_count = 1;
if (!empty($schema['join'])) {
@ -451,7 +451,7 @@ function ctools_export_load_object($table, $type = 'all', $args = array()) {
if ($type == 'names') {
$query->condition($export['key'], $args, 'IN');
}
else if ($type == 'conditions') {
elseif ($type == 'conditions') {
foreach ($args as $key => $value) {
if (isset($schema['fields'][$key])) {
$query->condition($key, $value);
@ -499,7 +499,7 @@ function ctools_export_load_object($table, $type = 'all', $args = array()) {
if ($defaults) {
foreach ($defaults as $object) {
if ($type == 'conditions') {
// if this does not match all of our conditions, skip it.
// If this does not match all of our conditions, skip it.
foreach ($args as $key => $value) {
if (!isset($object->$key)) {
continue 2;
@ -509,12 +509,12 @@ function ctools_export_load_object($table, $type = 'all', $args = array()) {
continue 2;
}
}
else if ($object->$key != $value) {
elseif ($object->$key != $value) {
continue 2;
}
}
}
else if ($type == 'names') {
elseif ($type == 'names') {
if (!in_array($object->{$export['key']}, $args)) {
continue;
}
@ -561,7 +561,6 @@ function ctools_export_load_object($table, $type = 'all', $args = array()) {
}
}
// For conditions,
return $return;
}
@ -807,10 +806,10 @@ function _ctools_export_get_some_defaults($table, $export, $names) {
function _ctools_export_unpack_object($schema, $data, $object = 'stdClass') {
if (is_string($object)) {
if (class_exists($object)) {
$object = new $object;
$object = new $object();
}
else {
$object = new stdClass;
$object = new stdClass();
}
}
@ -873,14 +872,14 @@ function ctools_var_export($var, $prefix = '') {
$output .= $prefix . ')';
}
}
else if (is_object($var) && get_class($var) === 'stdClass') {
elseif (is_object($var) && get_class($var) === 'stdClass') {
// var_export() will export stdClass objects using an undefined
// magic method __set_state() leaving the export broken. This
// workaround avoids this by casting the object as an array for
// export and casting it back to an object when evaluated.
$output = '(object) ' . ctools_var_export((array) $var, $prefix);
}
else if (is_bool($var)) {
elseif (is_bool($var)) {
$output = $var ? 'TRUE' : 'FALSE';
}
else {
@ -959,7 +958,7 @@ function ctools_export_object($table, $object, $indent = '', $identifier = NULL,
}
}
// And bottom additions here
// And bottom additions here.
foreach ($additions2 as $field => $value) {
$output .= $indent . '$' . $identifier . '->' . $field . ' = ' . ctools_var_export($value, $indent) . ";\n";
}
@ -987,7 +986,7 @@ function ctools_export_get_schema($table) {
// simply hasn't been cached. If we've been asked, let's force the
// issue.
if (!$schema || empty($schema['export'])) {
// force a schema reset:
// Force a schema reset:
$schema = drupal_get_schema($table, TRUE);
}
@ -999,7 +998,7 @@ function ctools_export_get_schema($table) {
return array();
}
// Add some defaults
// Add some defaults.
$schema['export'] += array(
'key' => 'name',
'key name' => 'Name',
@ -1107,7 +1106,7 @@ function ctools_export_set_object_status($object, $new_status = TRUE) {
$export = $schema['export'];
$status = variable_get($export['status'], array());
// Compare
// Compare.
if (!$new_status && $object->export_type & EXPORT_IN_DATABASE) {
unset($status[$object->{$export['key']}]);
}
@ -1150,12 +1149,12 @@ function ctools_export_new_object($table, $set_defaults = TRUE) {
$schema = ctools_export_get_schema($table);
$export = $schema['export'];
$object = new $export['object'];
$object = new $export['object']();
foreach ($schema['fields'] as $field => $info) {
if (isset($info['object default'])) {
$object->$field = $info['object default'];
}
else if (isset($info['default'])) {
elseif (isset($info['default'])) {
$object->$field = $info['default'];
}
else {
@ -1180,11 +1179,11 @@ function ctools_export_new_object($table, $set_defaults = TRUE) {
function ctools_export_to_hook_code(&$code, $table, $names = array(), $name = 'foo') {
$schema = ctools_export_get_schema($table);
$export = $schema['export'];
// Use the schema-specified function for generating hook code, if one exists
// Use the schema-specified function for generating hook code, if one exists.
if (function_exists($export['to hook code callback'])) {
$output = $export['to hook code callback']($names, $name);
}
// Otherwise, the following code generates basic hook code
// Otherwise, the following code generates basic hook code.
else {
$output = ctools_export_default_to_hook_code($schema, $table, $names, $name);
}
@ -1236,6 +1235,7 @@ function ctools_export_default_to_hook_code($schema, $table, $names, $name) {
return $output;
}
/**
* Default function for listing bulk exportable objects.
*/

View File

@ -5,7 +5,6 @@
* Extend core fields with some helper functions to reduce code complexity within views and ctools plugins.
*/
/**
* Fake an instance of a field.
*
@ -75,27 +74,30 @@ function ctools_fields_get_field_formatter_settings_form($field, $formatter_type
$conf['formatter_settings'] += $formatter['settings'];
}
$function = $formatter['module'] . '_field_formatter_settings_form';
if (function_exists($function)) {
$instance = ctools_fields_fake_field_instance($field['field_name'], $view_mode, $formatter_type, $conf['formatter_settings']);
$settings_form = $function($field, $instance, $view_mode, $form, $form_state);
if ($settings_form) {
// Allow other modules to alter the formatter settings form.
$context = array(
'module' => $formatter['module'],
'formatter' => $formatter,
'field' => $field,
'instance' => $instance,
'view_mode' => $view_mode,
'form' => $form,
'form_state' => $form_state,
);
drupal_alter('field_formatter_settings_form', $settings_form, $context);
$settings_form['#tree'] = TRUE;
$form['ctools_field_list']['#value'][] = $field;
$form += $settings_form;
}
$instance = ctools_fields_fake_field_instance($field['field_name'], $view_mode, $formatter_type, $conf['formatter_settings']);
if (function_exists($function)) {
$settings_form = $function($field, $instance, $view_mode, $form, $form_state);
}
if (empty($settings_form)) {
$settings_form = array();
}
// Allow other modules to alter the formatter settings form.
$context = array(
'module' => $formatter['module'],
'formatter' => $formatter,
'field' => $field,
'instance' => $instance,
'view_mode' => $view_mode,
'form' => $form,
'form_state' => $form_state,
);
drupal_alter('field_formatter_settings_form', $settings_form, $context);
$settings_form['#tree'] = TRUE;
$form['ctools_field_list']['#value'][] = $field;
$form += $settings_form;
if (isset($field['cardinality']) && $field['cardinality'] != 1) {
list($prefix, $suffix) = explode('@count', t('Skip the first @count item(s)'));
@ -208,15 +210,15 @@ function ctools_field_label($field_name) {
* - Otherwise NULL.
* @param $options
* An associative array of additional options, with the following keys:
* - 'field_name': The name of the field whose operation should be
* - 'field_name': The name of the field whose operation should be
* invoked. By default, the operation is invoked on all the fields
* in the entity's bundle. NOTE: This option is not compatible with
* the 'deleted' option; the 'field_id' option should be used
* instead.
* - 'field_id': The id of the field whose operation should be
* - 'field_id': The id of the field whose operation should be
* invoked. By default, the operation is invoked on all the fields
* in the entity's' bundles.
* - 'default': A boolean value, specifying which implementation of
* - 'default': A boolean value, specifying which implementation of
* the operation should be invoked.
* - if FALSE (default), the field types implementation of the operation
* will be invoked (hook_field_[op])
@ -224,10 +226,10 @@ function ctools_field_label($field_name) {
* will be invoked (field_default_[op])
* Internal use only. Do not explicitely set to TRUE, but use
* _field_invoke_default() instead.
* - 'deleted': If TRUE, the function will operate on deleted fields
* - 'deleted': If TRUE, the function will operate on deleted fields
* as well as non-deleted fields. If unset or FALSE, only
* non-deleted fields are operated on.
* - 'language': A language code or an array of language codes keyed by field
* - 'language': A language code or an array of language codes keyed by field
* name. It will be used to narrow down to a single value the available
* languages to act on.
*
@ -340,7 +342,7 @@ function ctools_field_foreign_keys($field_name) {
$foreign_keys[$field_name] = $field['foreign keys'];
}
else {
// try to fetch foreign keys from schema, as not everything
// Try to fetch foreign keys from schema, as not everything
// stores foreign keys properly in the field info.
$module = $field['module'];

View File

@ -8,7 +8,6 @@
* if javascript is in use. Each item is keyed to the href that the button
* should go to. With javascript, the page is immediately redirected. Without
* javascript, the form is submitted and a drupal_goto() is given.
*
*/
/**
@ -127,7 +126,7 @@ function ctools_jump_menu_submit($form, &$form_state) {
// This allows duplicate paths to be used in jump menus for multiple options.
$redirect_array = explode("::", $form_state['values']['jump']);
if(isset($redirect_array[1]) && !empty($redirect_array[1])){
if (isset($redirect_array[1]) && !empty($redirect_array[1])) {
$redirect = $redirect_array[1];
}
else {

View File

@ -1,5 +1,9 @@
<?php
/**
* @file
*/
/**
* Returns array of language names.
*
@ -32,7 +36,6 @@ function ctools_language_list($field = 'name', $all = FALSE) {
* Returns an array of language names similar to ctools_language_list() except
* that additional choices have been added for ease of use.
*/
function ctools_language_list_all() {
$languages = array(
'***CURRENT_LANGUAGE***' => t("Current user's language"),
@ -41,4 +44,4 @@ function ctools_language_list_all() {
);
$languages = array_merge($languages, ctools_language_list());
return $languages;
}
}

View File

@ -99,7 +99,10 @@ class ctools_math_expr {
'sqrt','abs','ln','log',
'time', 'ceil', 'floor', 'min', 'max', 'round');
function __construct() {
/**
* ctools_math_expr constructor.
*/
function __construct() {
// make the variables a little more accurate
$this->v['pi'] = pi();
$this->v['e'] = exp(1);

View File

@ -55,9 +55,9 @@ function ctools_modal_add_js() {
'alt' => t('Close window'),
)),
'throbber' => theme('image', array(
'path' => ctools_image_path('throbber.gif'),
'title' => t('Loading...'),
'alt' => t('Loading'),
'path' => ctools_image_path('throbber.gif'),
'title' => t('Loading...'),
'alt' => t('Loading'),
)),
),
);
@ -85,7 +85,7 @@ function ctools_modal_add_plugin_js($plugins) {
if (file_exists($file)) {
$js[$file] = TRUE;
}
else if (file(exists($subtype['path'] . '/' . $file))) {
elseif (file(exists($subtype['path'] . '/' . $file))) {
$js[$subtype['path'] . '/' . $file] = TRUE;
}
}
@ -95,7 +95,7 @@ function ctools_modal_add_plugin_js($plugins) {
if (file_exists($file)) {
$css[$file] = TRUE;
}
else if (file(exists($subtype['path'] . '/' . $file))) {
elseif (file(exists($subtype['path'] . '/' . $file))) {
$css[$subtype['path'] . '/' . $file] = TRUE;
}
}
@ -140,7 +140,7 @@ function ctools_modal_command_dismiss() {
}
/**
* Display loading screen in the modal
* Display loading screen in the modal.
*/
function ctools_modal_command_loading() {
return array(
@ -189,7 +189,7 @@ function ctools_modal_text_button($text, $dest, $alt, $class = '') {
* Wrap a form so that we can use it properly with AJAX. Essentially if the
* form wishes to render, it automatically does that, otherwise it returns
* the render array so we can see submission results.
*
* @param array $form
* An associative array containing the structure of the form.
* @param array $form_state
@ -222,7 +222,7 @@ function ctools_modal_form_wrapper($form_id, &$form_state) {
$output = drupal_build_form($form_id, $form_state);
if (!empty($form_state['ajax']) && (!$form_state['executed'] || $form_state['rebuild'])) {
return ctools_modal_form_render($form_state, $output);
return ctools_modal_form_render($form_state, $output);
}
return $output;

View File

@ -27,6 +27,7 @@
* defaults to session_id().
*
* @deprecated $skip_cache is deprecated in favor of drupal_static*
*
* @return
* The data that was cached.
*/
@ -42,8 +43,11 @@ function ctools_object_cache_get($obj, $name, $skip_cache = FALSE, $sid = NULL)
}
if (!array_key_exists($key, $cache)) {
$data = db_query('SELECT * FROM {ctools_object_cache} WHERE sid = :session_id AND obj = :object AND name = :name', array(':session_id' => $sid, ':object' => $obj, ':name' => $name))
->fetchObject();
$data = db_query('SELECT * FROM {ctools_object_cache} WHERE sid = :session_id AND obj = :object AND name = :name', array(
':session_id' => $sid,
':object' => $obj,
':name' => md5($name),
))->fetchObject();
if ($data) {
$cache[$key] = unserialize($data->data);
}
@ -83,7 +87,7 @@ function ctools_object_cache_set($obj, $name, $cache, $sid = NULL) {
->fields(array(
'sid' => $sid,
'obj' => $obj,
'name' => $name,
'name' => md5($name),
'data' => serialize($cache),
'updated' => REQUEST_TIME,
))
@ -91,7 +95,7 @@ function ctools_object_cache_set($obj, $name, $cache, $sid = NULL) {
}
/**
* Remove an object from the non-volatile ctools cache
* Remove an object from the non-volatile ctools cache.
*
* @param $obj
* A 128 character or less string to define what kind of object is being
@ -103,7 +107,6 @@ function ctools_object_cache_set($obj, $name, $cache, $sid = NULL) {
* defaults to session_id().
*/
function ctools_object_cache_clear($obj, $name, $sid = NULL) {
if (!$sid) {
$sid = session_id();
}
@ -111,13 +114,12 @@ function ctools_object_cache_clear($obj, $name, $sid = NULL) {
db_delete('ctools_object_cache')
->condition('sid', $sid)
->condition('obj', $obj)
->condition('name', $name)
->condition('name', md5($name))
->execute();
// Ensure the static cache is emptied of this obj:name set.
drupal_static_reset('ctools_object_cache_get');
}
/**
* Determine if another user has a given object cached.
*
@ -142,8 +144,11 @@ function ctools_object_cache_test($obj, $name, $sid = NULL) {
$sid = session_id();
}
return db_query('SELECT s.uid, c.updated FROM {ctools_object_cache} c INNER JOIN {sessions} s ON c.sid = s.sid WHERE s.sid <> :session_id AND c.obj = :obj AND c.name = :name ORDER BY c.updated ASC', array(':session_id' => $sid, ':obj' => $obj, ':name' => $name))
->fetchObject();
return db_query('SELECT s.uid, c.updated FROM {ctools_object_cache} c INNER JOIN {sessions} s ON c.sid = s.sid WHERE s.sid <> :session_id AND c.obj = :obj AND c.name = :name ORDER BY c.updated ASC', array(
':session_id' => $sid,
':obj' => $obj,
':name' => md5($name),
))->fetchObject();
}
/**
@ -162,6 +167,7 @@ function ctools_object_cache_test($obj, $name, $sid = NULL) {
* An array of objects containing the UID and updated date for each name found.
*/
function ctools_object_cache_test_objects($obj, $names) {
array_walk($names, 'md5');
return db_query("SELECT c.name, s.uid, c.updated FROM {ctools_object_cache} c INNER JOIN {sessions} s ON c.sid = s.sid WHERE c.obj = :obj AND c.name IN (:names) ORDER BY c.updated ASC", array(':obj' => $obj, ':names' => $names))
->fetchAllAssoc('name');
}
@ -180,7 +186,7 @@ function ctools_object_cache_test_objects($obj, $names) {
function ctools_object_cache_clear_all($obj, $name) {
db_delete('ctools_object_cache')
->condition('obj', $obj)
->condition('name', $name)
->condition('name', md5($name))
->execute();
// Ensure the static cache is emptied of this obj:name set.
$cache = &drupal_static('ctools_object_cache_get', array());
@ -197,7 +203,8 @@ function ctools_object_cache_clear_all($obj, $name) {
*/
function ctools_object_cache_clean($age = NULL) {
if (empty($age)) {
$age = 86400 * 7; // 7 days
// 7 days.
$age = 86400 * 7;
}
db_delete('ctools_object_cache')
->condition('updated', REQUEST_TIME - $age, '<')

View File

@ -1,5 +1,9 @@
<?php
/**
* @file
*/
/**
* Fetch metadata on a specific page_wizard plugin.
*
@ -53,7 +57,7 @@ function page_manager_get_wizard_cache($plugin) {
}
function page_manager_make_wizard_cache($plugin) {
$cache = new stdClass;
$cache = new stdClass();
$cache->plugin = $plugin;
if ($function = ctools_plugin_get_function($plugin, 'default cache')) {
$function($cache);

View File

@ -10,6 +10,7 @@
*
* Implementing this
*/
/**
* Get a plugin configuration form.
*
@ -100,7 +101,7 @@ function _ctools_plugin_configure_create_form_info(&$form_info, $plugin_definiti
if (empty($plugin_definition['title'])) {
$title = t('Configure');
}
else if ($op == 'add') {
elseif ($op == 'add') {
$title = t('Configure new !plugin_title', array('!plugin_title' => $plugin_definition['title']));
}
else {
@ -134,10 +135,10 @@ function _ctools_plugin_configure_create_form_info(&$form_info, $plugin_definiti
$form_info['forms']['form']['wrapper'] = 'ctools_plugins_default_form_wrapper';
}
}
else if (is_array($info)) {
if (empty($form_info['order'])) {
$form_info['order'] = array();
}
elseif (is_array($info)) {
if (empty($form_info['order'])) {
$form_info['order'] = array();
}
if (empty($form_info['forms'])) {
$form_info['forms'] = array();
}

View File

@ -2,7 +2,6 @@
/**
* @file
*
* Contains routines to organize and load plugins. It allows a special
* variation of the hook system so that plugins can be kept in separate
* .inc files, and can be either loaded all at once or loaded only when
@ -70,7 +69,7 @@ function ctools_plugin_api_info($owner, $api, $minimum_version, $current_version
if (isset($info['version'])) {
$version = $info['version'];
}
else if (isset($info['api'])) {
elseif (isset($info['api'])) {
$version = $info['api'];
}
@ -99,7 +98,7 @@ function ctools_plugin_api_info($owner, $api, $minimum_version, $current_version
}
// Only process if version is between minimum and current, inclusive.
if (version_compare($info['version'], $minimum_version, '>=') && version_compare($info['version'], $current_version, '<=')) {
if (version_compare($info['version'], $minimum_version, '>=') && version_compare($info['version'], $current_version, '<=')) {
if (!isset($info['path'])) {
$info['path'] = '';
}
@ -151,7 +150,7 @@ function ctools_plugin_api_include($owner, $api, $minimum_version, $current_vers
if (isset($plugin_info["$api file"])) {
$file = $plugin_info["$api file"];
}
else if (isset($plugin_info['file'])) {
elseif (isset($plugin_info['file'])) {
$file = $plugin_info['file'];
}
else {
@ -161,7 +160,7 @@ function ctools_plugin_api_include($owner, $api, $minimum_version, $current_vers
if (file_exists(DRUPAL_ROOT . "/$plugin_info[path]/$file")) {
require_once DRUPAL_ROOT . "/$plugin_info[path]/$file";
}
else if (file_exists(DRUPAL_ROOT . "/$file")) {
elseif (file_exists(DRUPAL_ROOT . "/$file")) {
require_once DRUPAL_ROOT . "/$file";
}
$already_done[$owner][$api][$module] = TRUE;
@ -184,7 +183,7 @@ function ctools_plugin_api_get_hook($owner, $api) {
if (function_exists($function = $owner . '_' . $api . '_hook_name')) {
$hook = $function();
}
else if (function_exists($function = $owner . '_ctools_plugin_api_hook_name')) {
elseif (function_exists($function = $owner . '_ctools_plugin_api_hook_name')) {
$hook = $function();
}
@ -225,7 +224,7 @@ function ctools_get_plugins($module, $type, $id = NULL) {
$info = ctools_plugin_get_plugin_type_info();
if (!isset($info[$module][$type])) {
// If we don't find the plugin we attempt a cache rebuild before bailing out
// If we don't find the plugin we attempt a cache rebuild before bailing out.
$info = ctools_plugin_get_plugin_type_info(TRUE);
// Bail out noisily if an invalid module/type combination is requested.
if (!isset($info[$module][$type])) {
@ -258,9 +257,9 @@ function ctools_get_plugins($module, $type, $id = NULL) {
if (!empty($cache->data)) {
// Cache load succeeded so use the cached plugin list.
$plugins[$module][$type] = $cache->data;
$plugins[$module][$type] = $cache->data;
// Set $setup to true so we know things where loaded.
$setup[$module][$type] = TRUE;
$setup[$module][$type] = TRUE;
}
else {
// Cache load failed so store that we need to build and write the cache.
@ -299,7 +298,6 @@ function ctools_get_plugins($module, $type, $id = NULL) {
}
}
// If we were told earlier that this is cacheable and the cache was empty,
// give something back.
if ($build_cache) {
@ -313,7 +311,7 @@ function ctools_get_plugins($module, $type, $id = NULL) {
return array_filter($plugins[$module][$type]);
}
// Check to see if we need to look for the file
// Check to see if we need to look for the file.
if (!array_key_exists($id, $plugins[$module][$type])) {
// If we can have child plugins, check to see if the plugin name is in the
// format of parent:child and break it up if it is.
@ -419,19 +417,20 @@ function ctools_get_plugins_reset() {
/**
* Load plugins from a directory.
*
* @param $info
* @param array $info
* The plugin info as returned by ctools_plugin_get_info()
* @param $file
* @param string $filename
* The file to load if we're looking for just one particular plugin.
*
* @return
* An array of information created for this plugin.
* @return array
* A (possibly empty) array of information created for this plugin.
*/
function ctools_plugin_load_includes($info, $filename = NULL) {
// Keep a static array so we don't hit file_scan_directory more than necessary.
$all_files = &drupal_static(__FUNCTION__, array());
// store static of plugin arrays for reference because they can't be reincluded.
// Store static of plugin arrays for reference because they can't be
// reincluded, so there is no point in using drupal_static().
static $plugin_arrays = array();
if (!isset($all_files[$info['module']][$info['type']])) {
@ -466,24 +465,23 @@ function ctools_plugin_load_includes($info, $filename = NULL) {
}
foreach ($files as $file) {
if (!empty($info['info file'])) {
// Parse a .info file
// Parse a .info file.
$result = ctools_plugin_process_info($info, $module, $file);
}
else {
// Parse a hook.
$plugin = NULL; // ensure that we don't have something leftover from earlier.
// Ensure that we don't have something leftover from earlier.
$plugin = NULL;
if (isset($plugin_arrays[$file->uri])) {
$identifier = $plugin_arrays[$file->uri];
}
else {
include_once DRUPAL_ROOT . '/' . $file->uri;
// .inc files have a special format for the hook identifier.
// For example, 'foo.inc' in the module 'mogul' using the plugin
// whose hook is named 'borg_type' should have a function named (deep breath)
// mogul_foo_borg_type()
// whose hook is named 'borg_type' should have a function named
// (deep breath) mogul_foo_borg_type().
// If, however, the .inc file set the quasi-global $plugin array, we
// can use that and not even call a function. Set the $identifier
// appropriately and ctools_plugin_process() will handle it.
@ -496,7 +494,8 @@ function ctools_plugin_load_includes($info, $filename = NULL) {
}
}
$result = ctools_plugin_process($info, $module, $identifier, dirname($file->uri), basename($file->uri), $file->name);
$result = ctools_plugin_process($info, $module, $identifier,
dirname($file->uri), basename($file->uri), $file->name);
}
if (is_array($result)) {
$plugins = array_merge($plugins, $result);
@ -516,7 +515,7 @@ function ctools_plugin_load_includes($info, $filename = NULL) {
* @param $info
* The $info array for the plugin as returned by ctools_plugin_get_info().
*
* @return array $directories
* @return array
* An array of directories to search.
*/
function ctools_plugin_get_directories($info) {
@ -542,10 +541,9 @@ function ctools_plugin_get_directories($info) {
}
/**
* Helper function to build a ctools-friendly list of themes capable of
* providing plugins.
* Helper to build a ctools-friendly list of themes capable of providing plugins.
*
* @return array $themes
* @return array
* A list of themes that can act as plugin providers, sorted parent-first with
* the active theme placed last.
*/
@ -556,7 +554,7 @@ function _ctools_list_themes() {
$themes = $active = array();
$all_themes = list_themes();
foreach ($all_themes as $name => $theme) {
// Only search from active themes
// Only search from active themes.
if (empty($theme->status) && $theme->name != $current) {
continue;
}
@ -567,19 +565,19 @@ function _ctools_list_themes() {
}
}
// Construct a parent-first list of all themes
// Construct a parent-first list of all themes.
foreach ($active as $name => $theme) {
$base_themes = isset($theme->base_themes) ? $theme->base_themes : array();
$themes = array_merge($themes, $base_themes, array($name => $theme->info['name']));
}
// Put the actual theme info objects into the array
// Put the actual theme info objects into the array.
foreach (array_keys($themes) as $name) {
if (isset($all_themes[$name])) {
$themes[$name] = $all_themes[$name];
}
}
// Make sure the current default theme always gets the last word
// Make sure the current default theme always gets the last word.
if ($current_key = array_search($current, array_keys($themes))) {
$themes += array_splice($themes, $current_key, 1);
}
@ -587,7 +585,6 @@ function _ctools_list_themes() {
return $themes;
}
/**
* Find all the base themes for the specified theme.
*
@ -603,9 +600,10 @@ function _ctools_list_themes() {
* The name of the theme whose base we are looking for.
* @param $used_keys
* A recursion parameter preventing endless loops.
* @return
*
* @return array
* Returns an array of all of the theme's ancestors; the first element's value
* will be NULL if an error occurred.
* will be NULL if an error occurred. (Note: this is NOT $arr[0]).
*/
function ctools_find_base_themes($themes, $key, $used_keys = array()) {
$base_key = $themes[$key]->info['base theme'];
@ -633,7 +631,6 @@ function ctools_find_base_themes($themes, $key, $used_keys = array()) {
return $current_base_theme;
}
/**
* Load plugin info for the provided hook; this is handled separately from
* plugins from files.
@ -658,22 +655,28 @@ function ctools_plugin_load_hooks($info) {
/**
* Process a single hook implementation of a ctools plugin.
*
* @param $info
* @param array $info
* The $info array about the plugin as returned by ctools_plugin_get_info()
* @param $module
* @param string $module
* The module that implements the plugin being processed.
* @param $identifier
* The plugin identifier, which is used to create the name of the hook
* function being called.
* @param $path
* @param string|array $identifier
* Used to create the base setting of return value. If:
* - $identifier is a string, a hook name is created from this and the 'hook'
* key of the $info array, and the return value of that hook function is
* used. The hook is called like this: $identifier_$hook($info);
* - $identifier is an array, this array is used directly.
* @param string $path
* The path where files utilized by this plugin will be found.
* @param $file
* @param string $file
* The file that was loaded for this plugin, if it exists.
* @param $base
* @param string $base
* The base plugin name to use. If a file was loaded for the plugin, this
* is the plugin to assume must be present. This is used to automatically
* translate the array to make the syntax more friendly to plugin
* implementors.
*
* @return null|array
* NULL on failure, otherwise an array containing the results keyed by name.
*/
function ctools_plugin_process($info, $module, $identifier, $path, $file = NULL, $base = NULL) {
if (is_array($identifier)) {
@ -741,9 +744,19 @@ function _ctools_process_data($result, $plugin_type_info, $module, $path, $file)
return $result;
}
/**
* Process an info file for plugin information, rather than a hook.
*
* @param array $info
* The $info array about the plugin as returned by ctools_plugin_get_info()
* @param string $module
* The module that implements the plugin being processed.
* @param object $file
* An object containing 'uri' and 'name' properties. 'uri' is the name of the
* 'info' file to process. 'name' is the plugin key-name.
*
* @return null|array
* NULL on failure, otherwise an array containing the results keyed by name.
*/
function ctools_plugin_process_info($info, $module, $file) {
$result = drupal_parse_info_file($file->uri);
@ -770,7 +783,7 @@ function ctools_plugin_get_info($module, $type) {
* @param $function_name
* The identifier of the function. For example, 'settings form'.
*
* @return
* @return string
* The actual name of the function to call, or NULL if the function
* does not exist.
*/
@ -787,7 +800,7 @@ function ctools_plugin_get_function($plugin_definition, $function_name) {
}
if (!isset($plugin_definition[$function_name])) {
return;
return NULL;
}
if (is_array($plugin_definition[$function_name]) && isset($plugin_definition[$function_name]['function'])) {
@ -822,7 +835,7 @@ function ctools_plugin_get_function($plugin_definition, $function_name) {
* @param $function_name
* The identifier of the function. For example, 'settings form'.
*
* @return
* @return string
* The actual name of the function to call, or NULL if the function
* does not exist.
*/
@ -840,7 +853,7 @@ function ctools_plugin_load_function($module, $type, $id, $function_name) {
* @param $class_name
* The identifier of the class. For example, 'handler'.
*
* @return
* @return string
* The actual name of the class to call, or NULL if the class does not exist.
*/
function ctools_plugin_get_class($plugin_definition, $class_name) {
@ -859,11 +872,11 @@ function ctools_plugin_get_class($plugin_definition, $class_name) {
if (!isset($plugin_definition[$class_name])) {
return;
}
else if (is_string($plugin_definition[$class_name])) {
elseif (is_string($plugin_definition[$class_name])) {
// Plugin uses the string form shorthand.
$return = $plugin_definition[$class_name];
}
else if (isset($plugin_definition[$class_name]['class'])) {
elseif (isset($plugin_definition[$class_name]['class'])) {
// Plugin uses the verbose array form.
$return = $plugin_definition[$class_name]['class'];
}
@ -885,7 +898,7 @@ function ctools_plugin_get_class($plugin_definition, $class_name) {
* @param $class_name
* The identifier of the class. For example, 'handler'.
*
* @return
* @return string
* The actual name of the class to call, or NULL if the class does not exist.
*/
function ctools_plugin_load_class($module, $type, $id, $class_name) {

View File

@ -2,7 +2,6 @@
/**
* @file
*
* Registry magic. In a separate file to minimize unnecessary code loading.
*/

View File

@ -202,7 +202,7 @@ function ctools_stylizer_get_settings_name($settings) {
}
/**
* Get the path where images will be stored for a given style plugin and settings.
* Get the path where images will be stored for a style plugin and settings.
*
* This function will make sure the path exists.
*/
@ -249,7 +249,7 @@ class ctools_stylizer_image_processor {
if (is_string($plugin['actions']) && function_exists($plugin['actions'])) {
$actions = $plugin['actions']($plugin, $settings);
}
else if (is_array($plugin['actions'])) {
elseif (is_array($plugin['actions'])) {
$actions = $plugin['actions'];
}
@ -318,7 +318,7 @@ class ctools_stylizer_image_processor {
function command_load($name, $file) {
$this->log("New workspace: $name (from $file)");
if (!file_exists($file)) {
// Try it relative to the plugin
// Try it relative to the plugin.
$file = $this->plugin['path'] . '/' . $file;
if (!file_exists($file)) {
$this->log("Unable to open $file");
@ -336,7 +336,7 @@ class ctools_stylizer_image_processor {
}
/**
* Create a new workspace using the properties of an existing workspace
* Create a new workspace using the properties of an existing workspace.
*/
function command_new_from($name, $workspace) {
$this->log("New workspace: $name from existing $workspace");
@ -372,7 +372,7 @@ class ctools_stylizer_image_processor {
function command_merge_from($workspace, $x = 0, $y = 0) {
$this->log("Merge from: $workspace ($x, $y)");
if (empty($this->workspaces[$workspace])) {
$this->log("Workspace $name does not exist.", 'error');
$this->log("Workspace $workspace does not exist.", 'error');
return;
}
@ -382,7 +382,7 @@ class ctools_stylizer_image_processor {
function command_merge_to($workspace, $x = 0, $y = 0) {
$this->log("Merge to: $workspace ($x, $y)");
if (empty($this->workspaces[$workspace])) {
$this->log("Workspace $name does not exist.", 'error');
$this->log("Workspace $workspace does not exist.", 'error');
return;
}
@ -822,7 +822,7 @@ function ctools_stylizer_add_plugin_forms(&$form_info, $plugin, $op) {
if ($op == 'add' && isset($plugin['add form'])) {
$id = $plugin['add form'];
}
else if (isset($plugin['edit form'])) {
elseif (isset($plugin['edit form'])) {
$id = $plugin['edit form'];
}
else {

View File

@ -25,4 +25,3 @@ function ctools_stylizer_theme(&$theme) {
'file' => 'includes/stylizer.inc',
);
}

View File

@ -23,7 +23,7 @@ function ctools_passthrough($module, $type, &$items) {
require_once DRUPAL_ROOT . '/' . $file->uri;
list($tool) = explode('.', $file->name, 2);
$function = $module . '_' . str_replace ('-', '_', $tool) . '_' . str_replace('-', '_', $type);
$function = $module . '_' . str_replace('-', '_', $tool) . '_' . str_replace('-', '_', $type);
if (function_exists($function)) {
$function($items);
}

View File

@ -67,4 +67,5 @@ if (!function_exists('uuid_is_valid')) {
function uuid_is_valid($uuid) {
return preg_match('/^' . UUID_PATTERN . '$/', $uuid);
}
}

View File

@ -1,5 +1,9 @@
<?php
/**
* @file
*/
/**
* Generate new context classes by argument settings on the view.
*/

View File

@ -47,7 +47,7 @@ function ctools_wizard_multistep_form($form_info, $step, &$form_state) {
// with form caching.
ctools_form_include($form_state, 'wizard');
// allow order array to be optional
// Allow order array to be optional.
if (empty($form_info['order'])) {
foreach ($form_info['forms'] as $step_id => $params) {
$form_info['order'][$step_id] = $params['title'];
@ -83,7 +83,7 @@ function ctools_wizard_multistep_form($form_info, $step, &$form_state) {
$form_info['cache location'] = 'storage';
}
// If absolutely nothing was set for the cache area to work on
// If absolutely nothing was set for the cache area to work on.
if (!isset($form_state[$form_info['cache location']])) {
ctools_include('cache');
$form_state[$form_info['cache location']] = ctools_cache_get($form_info['cache mechanism'], $form_info['cache key']);
@ -199,7 +199,7 @@ function ctools_wizard_multistep_form($form_info, $step, &$form_state) {
}
}
}
else if (isset($form_state['ajax next'])) {
elseif (isset($form_state['ajax next'])) {
// Clear a few items off the form state so we don't double post:
$next = $form_state['ajax next'];
unset($form_state['ajax next']);
@ -299,7 +299,7 @@ function ctools_wizard_wrapper($form, &$form_state) {
'#wizard type' => 'next',
'#weight' => -2000,
'#limit_validation_errors' => array(),
// hardcode the submit so that it doesn't try to save data.
// Hardcode the submit so that it doesn't try to save data.
'#submit' => array('ctools_wizard_submit'),
'#attributes' => $button_attributes,
);
@ -325,19 +325,18 @@ function ctools_wizard_wrapper($form, &$form_state) {
// end of the form list (i.e, there is a next) then it's "update and return"
// to be clear. If this is the end of the path and there is no next, we
// call it 'Finish'.
// Even if there is no direct return path (some forms may not want you
// leaving in the middle) the final button is always a Finish and it does
// whatever the return action is.
if (!empty($form_info['show return']) && !empty($form_state['next'])) {
$form['buttons']['return'] = array(
'#type' => 'submit',
'#value' => $form_info['return text'],
'#value' => $form_info['return text'],
'#wizard type' => 'return',
'#attributes' => $button_attributes,
);
}
else if (empty($form_state['next']) || !empty($form_info['free trail'])) {
elseif (empty($form_state['next']) || !empty($form_info['free trail'])) {
$form['buttons']['return'] = array(
'#type' => 'submit',
'#value' => $form_info['finish text'],
@ -352,7 +351,7 @@ function ctools_wizard_wrapper($form, &$form_state) {
'#type' => 'submit',
'#value' => $form_info['cancel text'],
'#wizard type' => 'cancel',
// hardcode the submit so that it doesn't try to save data.
// Hardcode the submit so that it doesn't try to save data.
'#limit_validation_errors' => array(),
'#submit' => array('ctools_wizard_submit'),
'#attributes' => $button_attributes,
@ -370,7 +369,6 @@ function ctools_wizard_wrapper($form, &$form_state) {
// Set up our submit handler after theirs. Since putting something here will
// skip Drupal's autodetect, we autodetect for it.
// We make sure ours is after theirs so that they get to change #next if
// the want to.
$form['#submit'] = array();
@ -398,7 +396,7 @@ function ctools_wizard_wrapper($form, &$form_state) {
$params = array($url, $options);
}
$form['#action'] = call_user_func_array('url', $params);
$form['#action'] = call_user_func_array('url', $params);
}
if (isset($info['wrapper']) && function_exists($info['wrapper'])) {
@ -418,7 +416,7 @@ function ctools_wizard_submit(&$form, &$form_state) {
if (isset($form_state['clicked_button']['#wizard type'])) {
$type = $form_state['clicked_button']['#wizard type'];
// if AJAX enabled, we proceed slightly differently here.
// If AJAX enabled, we proceed slightly differently here.
if (!empty($form_state['ajax'])) {
if ($type == 'next') {
$form_state['ajax next'] = $form_state['clicked_button']['#next'];
@ -428,7 +426,7 @@ function ctools_wizard_submit(&$form, &$form_state) {
if ($type == 'cancel' && isset($form_state['form_info']['cancel path'])) {
$form_state['redirect'] = $form_state['form_info']['cancel path'];
}
else if ($type == 'next') {
elseif ($type == 'next') {
$form_state['redirect'] = ctools_wizard_get_path($form_state['form_info'], $form_state['clicked_button']['#next']);
if (!empty($_GET['destination'])) {
// We don't want drupal_goto redirect this request
@ -437,10 +435,10 @@ function ctools_wizard_submit(&$form, &$form_state) {
unset($_GET['destination']);
}
}
else if (isset($form_state['form_info']['return path'])) {
elseif (isset($form_state['form_info']['return path'])) {
$form_state['redirect'] = $form_state['form_info']['return path'];
}
else if ($type == 'finish' && isset($form_state['form_info']['cancel path'])) {
elseif ($type == 'finish' && isset($form_state['form_info']['cancel path'])) {
$form_state['redirect'] = $form_state['form_info']['cancel path'];
}
}
@ -469,10 +467,8 @@ function ctools_wizard_get_path($form_info, $step) {
if (!isset($path[1]) || !is_array($path[1])) {
$path[1] = array();
}
// Ensure that the query part of options is an array.
$path[1] += array('query' => array());
// Add the destination parameter, if not set already.
$path[1]['query'] += drupal_get_destination();
$path[1] += drupal_get_destination();
}
return $path;
@ -505,15 +501,15 @@ function ctools_wizard_defaults(&$form_info) {
}
$form_info = $form_info + $defaults;
// set form callbacks if they aren't defined
// Set form callbacks if they aren't defined.
foreach ($form_info['forms'] as $step => $params) {
if (!$params['form id']) {
$form_callback = $hook . '_' . $step . '_form';
$form_info['forms'][$step]['form id'] = $form_callback;
if (empty($params['form id'])) {
$form_callback = $hook . '_' . $step . '_form';
$form_info['forms'][$step]['form id'] = $form_callback;
}
}
// set button callbacks
// Set button callbacks.
$callbacks = array(
'back callback' => '_back',
'next callback' => '_next',
@ -523,10 +519,10 @@ function ctools_wizard_defaults(&$form_info) {
);
foreach ($callbacks as $key => $callback) {
// never overwrite if explicity defined
// Never overwrite if explicity defined.
if (empty($form_info[$key])) {
$wizard_callback = $hook . $callback;
if (function_exists($wizard_callback)) {
if (function_exists($wizard_callback)) {
$form_info[$key] = $wizard_callback;
}
}

View File

@ -268,7 +268,7 @@
// We also have to check jQuery version to prevent
// IE8 + jQuery 1.4.4 to break on other events
// bound to the submit button.
if (jQuery.fn.jquery === '1.4' && typeof event.bubbles === "undefined") {
if (jQuery.fn.jquery.substr(0, 3) === '1.4' && typeof event.bubbles === "undefined") {
$(this.form).trigger('submit');
return false;
}
@ -302,7 +302,7 @@
// Attach behaviors within a modal dialog.
var settings = response.settings || ajax.settings || Drupal.settings;
Drupal.attachBehaviors('#modalContent', settings);
Drupal.attachBehaviors($('#modalContent'), settings);
if ($('#modal-content').hasClass('ctools-modal-loading')) {
$('#modal-content').removeClass('ctools-modal-loading');
@ -378,7 +378,7 @@
}
}
if (!speed) {
if (!speed && 0 !== speed) {
speed = 'fast';
}
@ -554,14 +554,15 @@
// Create our content div, get the dimensions, and hide it
var modalContent = $('#modalContent').css('top','-1000px');
var mdcTop = wt + ( winHeight / 2 ) - ( modalContent.outerHeight() / 2);
var $modalHeader = modalContent.find('.modal-header');
var mdcTop = wt + Math.max((winHeight / 2) - (modalContent.outerHeight() / 2), 0);
var mdcLeft = ( winWidth / 2 ) - ( modalContent.outerWidth() / 2);
$('#modalBackdrop').css(css).css('top', 0).css('height', docHeight + 'px').css('width', docWidth + 'px').show();
modalContent.css({top: mdcTop + 'px', left: mdcLeft + 'px'}).hide()[animation](speed);
// Bind a click for closing the modalContent
modalContentClose = function(){close(); return false;};
$('.close').bind('click', modalContentClose);
$('.close', $modalHeader).bind('click', modalContentClose);
// Bind a keypress on escape for closing the modalContent
modalEventEscapeCloseHandler = function(event) {
@ -577,7 +578,7 @@
// close button, but we should save the original focus to restore it after
// the dialog is closed.
var oldFocus = document.activeElement;
$('.close').focus();
$('.close', $modalHeader).focus();
// Close the open modal content and backdrop
function close() {
@ -586,36 +587,44 @@
$('body').unbind( 'focus', modalEventHandler);
$('body').unbind( 'keypress', modalEventHandler );
$('body').unbind( 'keydown', modalTabTrapHandler );
$('.close').unbind('click', modalContentClose);
$('body').unbind('keypress', modalEventEscapeCloseHandler);
$('.close', $modalHeader).unbind('click', modalContentClose);
$(document).unbind('keydown', modalEventEscapeCloseHandler);
$(document).trigger('CToolsDetachBehaviors', $('#modalContent'));
// Set our animation parameters and use them
if ( animation == 'fadeIn' ) animation = 'fadeOut';
if ( animation == 'slideDown' ) animation = 'slideUp';
if ( animation == 'show' ) animation = 'hide';
// Closing animation.
switch (animation) {
case 'fadeIn':
modalContent.fadeOut(speed, modalContentRemove);
break;
// Close the content
modalContent.hide()[animation](speed);
case 'slideDown':
modalContent.slideUp(speed, modalContentRemove);
break;
// Remove the content
case 'show':
modalContent.hide(speed, modalContentRemove);
break;
}
}
// Remove the content.
modalContentRemove = function () {
$('#modalContent').remove();
$('#modalBackdrop').remove();
// Restore focus to where it was before opening the dialog
// Restore focus to where it was before opening the dialog.
$(oldFocus).focus();
};
// Move and resize the modalBackdrop and modalContent on window resize.
modalContentResize = function(){
modalContentResize = function () {
// Reset the backdrop height/width to get accurate document size.
$('#modalBackdrop').css('height', '').css('width', '');
// Position code lifted from:
// http://www.quirksmode.org/viewport/compatibility.html
if (self.pageYOffset) { // all except Explorer
var wt = self.pageYOffset;
var wt = self.pageYOffset;
} else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict
var wt = document.documentElement.scrollTop;
} else if (document.body) { // all other Explorers
@ -631,7 +640,7 @@
// Get where we should move content to
var modalContent = $('#modalContent');
var mdcTop = wt + ( winHeight / 2 ) - ( modalContent.outerHeight() / 2);
var mdcTop = wt + Math.max((winHeight / 2) - (modalContent.outerHeight() / 2), 0);
var mdcLeft = ( winWidth / 2 ) - ( modalContent.outerWidth() / 2);
// Apply the changes
@ -662,9 +671,11 @@
$('body').unbind('focus', modalEventHandler);
$('body').unbind('keypress', modalEventHandler);
$('body').unbind( 'keydown', modalTabTrapHandler );
$('.close').unbind('click', modalContentClose);
var $modalContent = $('#modalContent');
var $modalHeader = $modalContent.find('.modal-header');
$('.close', $modalHeader).unbind('click', modalContentClose);
$('body').unbind('keypress', modalEventEscapeCloseHandler);
$(document).trigger('CToolsDetachBehaviors', $('#modalContent'));
$(document).trigger('CToolsDetachBehaviors', $modalContent);
// jQuery magic loop through the instances and run the animations or removal.
content.each(function(){

View File

@ -100,7 +100,7 @@ body form#page-manager-list-pages-form {
#page-manager-edit .page-manager-edit-operations li {
list-style: none;
background: #F6F6F6;
background: #f6f6f6;
border-top: 1px solid #aaa;
border-left: 1px solid #aaa;
border-right: 1px solid #aaa;
@ -111,7 +111,7 @@ body form#page-manager-list-pages-form {
#page-manager-edit .page-manager-edit-operations li.active,
#page-manager-edit .page-manager-edit-operations li.active-group .page-manager-group-title {
background: #FFFFFF url(../images/arrow-active.png) no-repeat scroll right center;
background: #ffffff url(../images/arrow-active.png) no-repeat scroll right center;
}
#page-manager-edit .page-manager-edit-operations li.changed,
@ -123,7 +123,7 @@ body form#page-manager-list-pages-form {
/** provide a reset for non active stray paths */
#page-manager-edit .page-manager-edit-operations li.active-group li.not-active .page-manager-group-title,
#page-manager-edit .page-manager-edit-operations li.changed-group li.not-changed .page-manager-group-title {
background: #F6F6F6;
background: #f6f6f6;
}
#page-manager-edit .page-manager-edit-operations li.active {
@ -132,7 +132,7 @@ body form#page-manager-list-pages-form {
#page-manager-edit .page-manager-edit-operations li.active a,
#page-manager-edit .page-manager-edit-operations li.active a:hover {
background: #FFFFFF url(../images/arrow-active.png) no-repeat scroll right center;
background: #ffffff url(../images/arrow-active.png) no-repeat scroll right center;
color: #000000;
font-weight: bold;
}
@ -271,8 +271,8 @@ body form#page-manager-list-pages-form {
#page-manager-edit .actions li a {
display: block;
padding: 0.2em 0.5em;
color:#0062A0;
background-color: #F6F6F6;
color: #0062a0;
background-color: #f6f6f6;
}
#page-manager-edit .page-manager-changed {

View File

@ -631,7 +631,7 @@ function page_manager_get_operations($page, $operations = NULL) {
if (isset($plugin['add features'][$id])) {
$result['actions']['children']['configure']['form']['order'][$id] = $plugin['add features'][$id];
}
else if (isset($plugin['required forms'][$id])) {
elseif (isset($plugin['required forms'][$id])) {
$result['actions']['children']['configure']['form']['order'][$id] = $plugin['required forms'][$id];
}
}
@ -732,7 +732,7 @@ function page_manager_get_handler_operations(&$page) {
),
);
}
else if ($handler->export_type != EXPORT_IN_CODE) {
elseif ($handler->export_type != EXPORT_IN_CODE) {
$actions['delete'] = array(
'title' => t('Delete'),
'description' => t('Remove this variant from the page completely.'),
@ -1144,7 +1144,7 @@ function page_manager_render_operations(&$page, $operations, $active_trail, $att
if ($id == $first) {
$class[] = 'operation-first';
}
else if ($id == $last) {
elseif ($id == $last) {
$class[] = 'operation-last';
}

View File

@ -3,11 +3,11 @@ description = Provides a UI and API to manage pages within the site.
core = 7.x
dependencies[] = ctools
package = Chaos tool suite
version = CTOOLS_MODULE_VERSION
; Information added by Drupal.org packaging script on 2016-11-22
version = "7.x-1.12"
files[] = tests/head_links.test
; Information added by Drupal.org packaging script on 2019-02-08
version = "7.x-1.15"
core = "7.x"
project = "ctools"
datestamp = "1479787162"
datestamp = "1549603691"

View File

@ -205,7 +205,7 @@ function page_manager_menu_alter(&$items) {
if ($function = ctools_plugin_get_function($task, 'hook menu alter')) {
$function($items, $task);
}
// let the subtasks alter the menu items too.
// Let the subtasks alter the menu items too.
foreach (page_manager_get_task_subtasks($task) as $subtask_id => $subtask) {
if ($function = ctools_plugin_get_function($subtask, 'hook menu alter')) {
$function($items, $subtask);
@ -240,7 +240,7 @@ function page_manager_menu_alter(&$items) {
return $items;
}
/*
/**
* Implements hook_theme()
*/
function page_manager_theme() {
@ -333,7 +333,7 @@ function page_manager_get_page_cache($task_name) {
}
}
else {
// ensure the task is loaded.
// Ensure the task is loaded.
page_manager_get_task($cache->task_id);
}
@ -390,11 +390,10 @@ function page_manager_save_page_cache($cache) {
foreach ($cache->handler_info as $id => $info) {
$handler = &$cache->handlers[$id];
// If it has been marked for deletion, delete it.
if ($info['changed'] & PAGE_MANAGER_CHANGED_DELETED) {
page_manager_delete_task_handler($handler);
}
// If it has been somehow edited (or added), write the cached version
// If it has been somehow edited (or added), write the cached version.
elseif ($info['changed'] & PAGE_MANAGER_CHANGED_CACHED) {
// Make sure we get updated weight from the form for this.
$handler->weight = $info['weight'];
@ -427,7 +426,7 @@ function page_manager_save_page_cache($cache) {
* Menu callback to load a page manager cache object for menu callbacks.
*/
function page_manager_cache_load($task_name) {
// load context plugin as there may be contexts cached here.
// Load context plugin as there may be contexts cached here.
ctools_include('context');
return page_manager_get_page_cache($task_name);
}
@ -500,7 +499,6 @@ function page_manager_handler_add_to_page(&$page, &$handler, $title = NULL) {
//
// This includes fetching plugins and plugin info as well as specialized
// fetch methods to get groups of task handlers per task.
/**
* Load a single task handler by name.
*
@ -582,7 +580,7 @@ function page_manager_get_default_task_handlers($task, $subtask_id) {
$handlers = $subtask['default handlers'];
}
}
else if (isset($task['default handlers'])) {
elseif (isset($task['default handlers'])) {
$handlers = $task['default handlers'];
}
@ -604,6 +602,7 @@ function page_manager_get_default_task_handlers($task, $subtask_id) {
* A list of handlers provided by the default task.
* @param $name
* Which handler to compare.
*
* @return
* Which handler to use, if any. May be NULL.
*/
@ -615,10 +614,10 @@ function page_manager_compare_task_handlers($result, $handlers, $name) {
$handlers[$name]->export_type = EXPORT_IN_CODE;
return $handlers[$name];
}
else if (isset($result[$name]) && !isset($handlers[$name])) {
elseif (isset($result[$name]) && !isset($handlers[$name])) {
return $result[$name];
}
else if (isset($result[$name]) && isset($handlers[$name])) {
elseif (isset($result[$name]) && isset($handlers[$name])) {
if ($result[$name]->export_type & EXPORT_IN_DATABASE) {
$result[$name]->type = t('Overridden');
$result[$name]->export_type = $result[$name]->export_type | EXPORT_IN_CODE;
@ -776,9 +775,8 @@ function page_manager_export_task_handler_load($name) {
function page_manager_new_task_handler($plugin) {
// Generate a unique name. Unlike most named objects, we don't let people choose
// names for task handlers because they mostly don't make sense.
// Create a new, empty handler object.
$handler = new stdClass;
$handler = new stdClass();
$handler->title = $plugin['title'];
$handler->task = NULL;
$handler->subtask = NULL;
@ -797,7 +795,7 @@ function page_manager_new_task_handler($plugin) {
if (is_array($plugin['default conf'])) {
$handler->conf = $plugin['default conf'];
}
else if (function_exists($plugin['default conf'])) {
elseif (function_exists($plugin['default conf'])) {
$handler->conf = $plugin['default conf']($handler);
}
}
@ -823,7 +821,6 @@ function page_manager_update_task_handler_weight($handler, $weight) {
->execute();
}
/**
* Shortcut function to get task plugins.
*/
@ -1200,7 +1197,7 @@ function page_manager_page_manager_pages_to_hook_code($names = array(), $name =
$code .= " */\n";
$code .= "function " . $name . "_{$export['default hook']}() {\n";
foreach ($objects as $object) {
// Have to implement our own because this export func sig requires it
// Have to implement our own because this export func sig requires it.
$code .= $export['export callback']($object, TRUE, ' ');
$code .= " \${$export['identifier']}s['" . check_plain($object->{$export['key']}) . "'] = \${$export['identifier']};\n\n";
}
@ -1310,7 +1307,7 @@ function page_manager_addressable_content($address, $type) {
$arguments = explode('..', $arguments);
}
else {
// implode does not return an empty array on an empty
// Implode does not return an empty array on an empty
// string so do it specifically.
$arguments = array();
}

View File

@ -7,7 +7,7 @@
*/
$plugin = array(
// cache plugins are the rare plugin types that have no real UI but
// Cache plugins are the rare plugin types that have no real UI but
// we're providing a title just in case.
'title' => t('Page manager context'),
'cache get' => 'page_manager_cache_page_manager_context_cache_get',
@ -46,7 +46,7 @@ function page_manager_cache_page_manager_context_cache_set($data, $key, $object)
}
/**
* Copy temporary data from the page manager cache
* Copy temporary data from the page manager cache.
*/
function page_manager_cache_page_manager_context_cache_finalize($data, $key, $object) {
// Statically cached so there shouldn't be any worries. It's an object so

View File

@ -2,14 +2,13 @@
/**
* @file
*
* This is the task handler plugin to handle generating 403, 404, 301 and 302
* response codes.
*/
// Plugin definition
// Plugin definition.
$plugin = array(
// is a 'context' handler type, meaning it supports the API of the
// Is a 'context' handler type, meaning it supports the API of the
// context handlers provided by ctools context plugins.
'handler type' => 'context',
'visible' => TRUE, // may be added up front.
@ -121,7 +120,7 @@ function page_manager_http_response_admin_summary($handler, $task, $subtask, $pa
ctools_include('context');
ctools_include('context-task-handler');
// Get the operations
// Get the operations.
$operations = page_manager_get_operations($page);
// Get operations for just this handler.
@ -190,7 +189,7 @@ function page_manager_http_response_admin_summary($handler, $task, $subtask, $pa
$output .= '<div class="clearfix">';
if ($show_title) {
$output .= '<div class="handler-title clearfix">';
$output .= '<div class="handler-title clearfix">';
$output .= '<div class="actions handler-actions">' . $rendered_operations['actions'] . '</div>';
$output .= '<span class="title-label">' . $title . '</span>';
}
@ -215,7 +214,7 @@ function page_manager_http_response_title($handler, $task, $subtask) {
}
/**
* General settings for the panel
* General settings for the panel.
*/
function page_manager_http_response_edit_settings($form, &$form_state) {
ctools_include('page_manager.admin', 'page_manager', '');
@ -302,7 +301,7 @@ function page_manager_http_response_render($handler, $base_contexts, $args, $tes
ctools_include('context');
ctools_include('context-task-handler');
// Add my contexts
// Add my contexts.
$contexts = ctools_context_handler_get_handler_contexts($base_contexts, $handler);
// Test.

View File

@ -1,5 +1,9 @@
<?php
/**
* @file
*/
/**
* Specialized implementation of hook_page_manager_task_tasks(). See api-task.html for
* more information.
@ -10,7 +14,7 @@ function page_manager_blog_page_manager_tasks() {
}
return array(
// This is a 'page' task and will fall under the page admin UI
// This is a 'page' task and will fall under the page admin UI.
'task type' => 'page',
'title' => t('All blogs'),
@ -68,7 +72,7 @@ function page_manager_blog_menu_alter(&$items, $task) {
* node edit, which is node_page_edit().
*/
function page_manager_blog() {
// Load my task plugin
// Load my task plugin.
$task = page_manager_get_task('blog');
ctools_include('context');
@ -113,6 +117,7 @@ function page_manager_blog_enable($cache, $status) {
* The subtask id
* @param $contexts
* The contexts loaded for the task.
*
* @return
* TRUE if the current user can access the page.
*/

View File

@ -1,5 +1,9 @@
<?php
/**
* @file
*/
/**
* Specialized implementation of hook_page_manager_task_tasks(). See api-task.html for
* more information.
@ -10,7 +14,7 @@ function page_manager_blog_user_page_manager_tasks() {
}
return array(
// This is a 'page' task and will fall under the page admin UI
// This is a 'page' task and will fall under the page admin UI.
'task type' => 'page',
'title' => t('User blog'),
'admin title' => t('User blog'),
@ -53,7 +57,7 @@ function page_manager_blog_user_menu_alter(&$items, $task) {
$items['blog/%user_uid_optional']['file'] = $task['file'];
}
else {
// automatically disable this task if it cannot be enabled.
// Automatically disable this task if it cannot be enabled.
variable_set('page_manager_blog_user_disabled', TRUE);
if (!empty($GLOBALS['page_manager_enabling_blog_user'])) {
drupal_set_message(t('Page manager module is unable to enable blog/%user because some other module already has overridden with %callback.', array('%callback' => $items['blog/%user']['page callback'])), 'error');
@ -143,6 +147,7 @@ function page_manager_blog_user_enable($cache, $status) {
* The subtask id
* @param $contexts
* The contexts loaded for the task.
*
* @return
* TRUE if the current user can access the page.
*/

View File

@ -1,4 +1,9 @@
<?php
/**
* @file
*/
/**
* Specialized implementation of hook_page_manager_task_tasks(). See api-task.html for
* more information.
@ -9,7 +14,7 @@ function page_manager_comment_reply_page_manager_tasks() {
}
return array(
// This is a 'page' task and will fall under the page admin UI
// This is a 'page' task and will fall under the page admin UI.
'task type' => 'page',
'title' => t('Comment Reply page'),
@ -45,13 +50,11 @@ function page_manager_comment_reply_enable($cache, $status) {
}
}
/**
* Entry point for our overridden comment.
*
*/
function page_manager_comment_reply_page($node, $pid = NULL){
// Load my task plugin
function page_manager_comment_reply_page($node, $pid = NULL) {
// Load my task plugin.
$task = page_manager_get_task('comment_reply');
// Load the node into a context.
@ -134,7 +137,7 @@ function page_manager_comment_reply_menu_alter(&$items, $task) {
$items['comment/reply/%node']['file'] = $task['file'];
}
else {
// automatically disable this task if it cannot be enabled.
// Automatically disable this task if it cannot be enabled.
variable_set('page_manager_comment_reply_disabled', TRUE);
if (!empty($GLOBALS['page_manager_enabling_comment_reply'])) {
drupal_set_message(t('Page manager module is unable to enable comment/reply/%node because some other module already has overridden with %callback.', array('%callback' => $callback)), 'error');
@ -153,6 +156,7 @@ function page_manager_comment_reply_menu_alter(&$items, $task) {
* The subtask id
* @param $contexts
* The contexts loaded for the task.
*
* @return
* TRUE if the current user can access the page.
*/

View File

@ -1,5 +1,9 @@
<?php
/**
* @file
*/
/**
* Specialized implementation of hook_page_manager_task_tasks(). See api-task.html for
* more information.
@ -10,7 +14,7 @@ function page_manager_contact_site_page_manager_tasks() {
}
return array(
// This is a 'page' task and will fall under the page admin UI
// This is a 'page' task and will fall under the page admin UI.
'task type' => 'page',
'title' => t('Site contact page'),
@ -72,7 +76,7 @@ function page_manager_contact_site_menu_alter(&$items, $task) {
* node edit, which is node_page_edit().
*/
function page_manager_contact_site() {
// Load my task plugin
// Load my task plugin.
$task = page_manager_get_task('contact_site');
ctools_include('context');
@ -121,6 +125,7 @@ function page_manager_contact_site_enable($cache, $status) {
* The subtask id
* @param $contexts
* The contexts loaded for the task.
*
* @return
* TRUE if the current user can access the page.
*/

Some files were not shown because too many files have changed in this diff Show More