Révision e4c061ad
Ajouté par Assos Assos il y a plus de 9 ans
drupal7/sites/all/modules/ctools/API.txt | ||
---|---|---|
3 | 3 |
Please note that the API version is an internal number and does not match release numbers. It is entirely possible that releases will not increase the API version number, and increasing this number too often would burden contrib module maintainers who need to keep up with API changes. |
4 | 4 |
|
5 | 5 |
This file contains a log of changes to the API. |
6 |
API Version 2.0.9 |
|
7 |
Changed import permissions to use the new 'use ctools import' permission. |
|
8 |
|
|
6 | 9 |
API Version 2.0.8 |
7 | 10 |
Introduce ctools_class_add(). |
8 | 11 |
Introduce ctools_class_remove(). |
drupal7/sites/all/modules/ctools/bulk_export/bulk_export.info | ||
---|---|---|
3 | 3 |
core = 7.x |
4 | 4 |
dependencies[] = ctools |
5 | 5 |
package = Chaos tool suite |
6 |
version = CTOOLS_MODULE_VERSION |
|
6 | 7 |
|
7 |
; Information added by Drupal.org packaging script on 2014-11-19 |
|
8 |
version = "7.x-1.5" |
|
8 |
|
|
9 |
; Information added by Drupal.org packaging script on 2015-01-28 |
|
10 |
version = "7.x-1.6" |
|
9 | 11 |
core = "7.x" |
10 | 12 |
project = "ctools" |
11 |
datestamp = "1416423525"
|
|
13 |
datestamp = "1422471484"
|
|
12 | 14 |
|
drupal7/sites/all/modules/ctools/ctools.info | ||
---|---|---|
2 | 2 |
description = A library of helpful tools by Merlin of Chaos. |
3 | 3 |
core = 7.x |
4 | 4 |
package = Chaos tool suite |
5 |
version = CTOOLS_MODULE_VERSION |
|
5 | 6 |
files[] = includes/context.inc |
7 |
files[] = includes/css-cache.inc |
|
6 | 8 |
files[] = includes/math-expr.inc |
7 | 9 |
files[] = includes/stylizer.inc |
10 |
files[] = tests/css_cache.test |
|
8 | 11 |
|
9 |
; Information added by Drupal.org packaging script on 2014-11-19
|
|
10 |
version = "7.x-1.5"
|
|
12 |
; Information added by Drupal.org packaging script on 2015-01-28
|
|
13 |
version = "7.x-1.6"
|
|
11 | 14 |
core = "7.x" |
12 | 15 |
project = "ctools" |
13 |
datestamp = "1416423525"
|
|
16 |
datestamp = "1422471484"
|
|
14 | 17 |
|
drupal7/sites/all/modules/ctools/ctools.install | ||
---|---|---|
40 | 40 |
* Implements hook_schema(). |
41 | 41 |
*/ |
42 | 42 |
function ctools_schema() { |
43 |
return ctools_schema_2(); |
|
43 |
return ctools_schema_3(); |
|
44 |
} |
|
45 |
|
|
46 |
/** |
|
47 |
* Version 3 of the CTools schema. |
|
48 |
*/ |
|
49 |
function ctools_schema_3() { |
|
50 |
$schema = ctools_schema_2(); |
|
51 |
|
|
52 |
// update the 'obj' field to be 128 bytes long: |
|
53 |
$schema['ctools_object_cache']['fields']['obj']['length'] = 128; |
|
54 |
|
|
55 |
return $schema; |
|
44 | 56 |
} |
45 | 57 |
|
46 | 58 |
/** |
... | ... | |
141 | 153 |
return $schema; |
142 | 154 |
} |
143 | 155 |
|
156 |
/** |
|
157 |
* Implements hook_install(). |
|
158 |
*/ |
|
159 |
function ctools_install() { |
|
160 |
// Activate our custom cache handler for the CSS cache. |
|
161 |
variable_set('cache_class_cache_ctools_css', 'CToolsCssCache'); |
|
162 |
} |
|
163 |
|
|
164 |
/** |
|
165 |
* Implements hook_uninstall(). |
|
166 |
*/ |
|
167 |
function ctools_uninstall() { |
|
168 |
variable_del('cache_class_cache_ctools_css'); |
|
169 |
} |
|
170 |
|
|
144 | 171 |
/** |
145 | 172 |
* Enlarge the ctools_object_cache.name column to prevent truncation and weird |
146 | 173 |
* errors. |
... | ... | |
217 | 244 |
) |
218 | 245 |
); |
219 | 246 |
} |
247 |
|
|
248 |
/** |
|
249 |
* Enable the custom CSS cache handler. |
|
250 |
*/ |
|
251 |
function ctools_update_7000() { |
|
252 |
variable_set('cache_class_cache_ctools_css', 'CToolsCssCache'); |
|
253 |
} |
|
254 |
|
|
255 |
/** |
|
256 |
* Increase the length of the ctools_object_cache.obj column. |
|
257 |
*/ |
|
258 |
function ctools_update_7001() { |
|
259 |
db_change_field('ctools_object_cache', 'obj', 'obj', array( |
|
260 |
'type' => 'varchar', |
|
261 |
'length' => '128', |
|
262 |
'not null' => TRUE, |
|
263 |
'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.', |
|
264 |
)); |
|
265 |
} |
drupal7/sites/all/modules/ctools/ctools.module | ||
---|---|---|
9 | 9 |
* must be implemented in the module file. |
10 | 10 |
*/ |
11 | 11 |
|
12 |
define('CTOOLS_API_VERSION', '2.0.7'); |
|
12 |
define('CTOOLS_API_VERSION', '2.0.8'); |
|
13 |
|
|
14 |
/** |
|
15 |
* The current working ctools version. |
|
16 |
* |
|
17 |
* In a release, it should be 7.x-1.x, which should match what drush make will |
|
18 |
* create. In a dev format, it should be 7.x-1.(x+1)-dev, which will allow |
|
19 |
* modules depending on new features in ctools to depend on ctools > 7.x-1.x. |
|
20 |
* |
|
21 |
* To define a specific version of CTools as a dependency for another module, |
|
22 |
* simply include a dependency line in that module's info file, e.g.: |
|
23 |
* ; Requires CTools v7.x-1.4 or newer. |
|
24 |
* dependencies[] = ctools (>=1.4) |
|
25 |
*/ |
|
26 |
define('CTOOLS_MODULE_VERSION', '7.x-1.6'); |
|
13 | 27 |
|
14 | 28 |
/** |
15 | 29 |
* Test the CTools API version. |
... | ... | |
536 | 550 |
return $items; |
537 | 551 |
} |
538 | 552 |
|
553 |
/** |
|
554 |
* Implements hook_permission(). |
|
555 |
*/ |
|
556 |
function ctools_permission() { |
|
557 |
return array( |
|
558 |
'use ctools import' => array( |
|
559 |
'title' => t('Use CTools importer'), |
|
560 |
'description' => t('The import functionality allows users to execute arbitrary PHP code, so extreme caution must be taken.'), |
|
561 |
'restrict access' => TRUE, |
|
562 |
), |
|
563 |
); |
|
564 |
} |
|
565 |
|
|
539 | 566 |
/** |
540 | 567 |
* Implementation of hook_cron. Clean up old caches. |
541 | 568 |
*/ |
... | ... | |
546 | 573 |
} |
547 | 574 |
|
548 | 575 |
/** |
549 |
* Ensure the CTools CSS cache is flushed whenever hook_flush_caches is invoked.
|
|
576 |
* Implements hook_flush_caches().
|
|
550 | 577 |
*/ |
551 | 578 |
function ctools_flush_caches() { |
552 |
// Do not actually flush caches if running on cron. Drupal uses this hook |
|
553 |
// in an inconsistent fashion and it does not necessarily mean to *flush* |
|
554 |
// caches when running from cron. Instead it's just getting a list of cache |
|
555 |
// tables and may not do any flushing. |
|
556 |
if (!empty($GLOBALS['locks']['cron'])) { |
|
557 |
return; |
|
558 |
} |
|
559 |
|
|
560 |
ctools_include('css'); |
|
561 |
ctools_css_flush_caches(); |
|
579 |
// Only return the CSS cache bin if it has been activated, to avoid |
|
580 |
// drupal_flush_all_caches() from trying to truncate a non-existing table. |
|
581 |
return variable_get('cache_class_cache_ctools_css', FALSE) ? array('cache_ctools_css') : array(); |
|
562 | 582 |
} |
563 | 583 |
|
564 | 584 |
/** |
... | ... | |
638 | 658 |
} |
639 | 659 |
} |
640 | 660 |
|
661 |
|
|
662 |
/** |
|
663 |
* Implements hook_page_alter(). |
|
664 |
* |
|
665 |
* Last ditch attempt to remove sidebar regions if the "no blocks" |
|
666 |
* functionality has been activated. |
|
667 |
* |
|
668 |
* @see ctools_block_list_alter(). |
|
669 |
*/ |
|
641 | 670 |
function ctools_page_alter(&$page) { |
671 |
$check = drupal_static('ctools_set_no_blocks', TRUE); |
|
672 |
if (!$check) { |
|
673 |
foreach ($page as $region_id => $region) { |
|
674 |
// @todo -- possibly we can set configuration for this so that users can |
|
675 |
// specify which blocks will not get rendered. |
|
676 |
if (strpos($region_id, 'sidebar') !== FALSE) { |
|
677 |
unset($page[$region_id]); |
|
678 |
} |
|
679 |
} |
|
680 |
} |
|
642 | 681 |
$page['#post_render'][] = 'ctools_page_token_processing'; |
643 | 682 |
} |
644 | 683 |
|
... | ... | |
786 | 825 |
return 0; |
787 | 826 |
} |
788 | 827 |
|
828 |
/** |
|
829 |
* Provides the default value for %ctools_js. |
|
830 |
* |
|
831 |
* This allows drupal_valid_path() to work with %ctools_js. |
|
832 |
*/ |
|
833 |
function ctools_js_to_arg($arg) { |
|
834 |
return empty($arg) || $arg == '%' ? 'nojs' : $arg; |
|
835 |
} |
|
836 |
|
|
789 | 837 |
/** |
790 | 838 |
* Menu _load hook. |
791 | 839 |
* |
... | ... | |
905 | 953 |
} |
906 | 954 |
|
907 | 955 |
/** |
908 |
* Implement hook_modules_enabled to clear static caches for detecting new plugins |
|
956 |
* Implements hook_modules_enabled(). |
|
957 |
* |
|
958 |
* Clear caches for detecting new plugins. |
|
909 | 959 |
*/ |
910 | 960 |
function ctools_modules_enabled($modules) { |
911 | 961 |
ctools_include('plugins'); |
912 | 962 |
ctools_get_plugins_reset(); |
963 |
cache_clear_all('ctools_plugin_files:', 'cache', TRUE); |
|
964 |
} |
|
965 |
|
|
966 |
/** |
|
967 |
* Implements hook_modules_disabled(). |
|
968 |
* |
|
969 |
* Clear caches for removing disabled plugins. |
|
970 |
*/ |
|
971 |
function ctools_modules_disabled($modules) { |
|
972 |
ctools_include('plugins'); |
|
973 |
ctools_get_plugins_reset(); |
|
974 |
cache_clear_all('ctools_plugin_files:', 'cache', TRUE); |
|
913 | 975 |
} |
914 | 976 |
|
915 | 977 |
/** |
drupal7/sites/all/modules/ctools/ctools_access_ruleset/ctools_access_ruleset.info | ||
---|---|---|
2 | 2 |
description = Create custom, exportable, reusable access rulesets for applications like Panels. |
3 | 3 |
core = 7.x |
4 | 4 |
package = Chaos tool suite |
5 |
version = CTOOLS_MODULE_VERSION |
|
5 | 6 |
dependencies[] = ctools |
6 | 7 |
|
7 |
; Information added by Drupal.org packaging script on 2014-11-19
|
|
8 |
version = "7.x-1.5"
|
|
8 |
; Information added by Drupal.org packaging script on 2015-01-28
|
|
9 |
version = "7.x-1.6"
|
|
9 | 10 |
core = "7.x" |
10 | 11 |
project = "ctools" |
11 |
datestamp = "1416423525"
|
|
12 |
datestamp = "1422471484"
|
|
12 | 13 |
|
drupal7/sites/all/modules/ctools/ctools_ajax_sample/ctools_ajax_sample.info | ||
---|---|---|
1 | 1 |
name = Chaos Tools (CTools) AJAX Example |
2 | 2 |
description = Shows how to use the power of Chaos AJAX. |
3 | 3 |
package = Chaos tool suite |
4 |
version = CTOOLS_MODULE_VERSION |
|
4 | 5 |
dependencies[] = ctools |
5 | 6 |
core = 7.x |
6 | 7 |
|
7 |
; Information added by Drupal.org packaging script on 2014-11-19
|
|
8 |
version = "7.x-1.5"
|
|
8 |
; Information added by Drupal.org packaging script on 2015-01-28
|
|
9 |
version = "7.x-1.6"
|
|
9 | 10 |
core = "7.x" |
10 | 11 |
project = "ctools" |
11 |
datestamp = "1416423525"
|
|
12 |
datestamp = "1422471484"
|
|
12 | 13 |
|
drupal7/sites/all/modules/ctools/ctools_custom_content/ctools_custom_content.info | ||
---|---|---|
2 | 2 |
description = Create custom, exportable, reusable content panes for applications like Panels. |
3 | 3 |
core = 7.x |
4 | 4 |
package = Chaos tool suite |
5 |
version = CTOOLS_MODULE_VERSION |
|
5 | 6 |
dependencies[] = ctools |
6 | 7 |
|
7 |
; Information added by Drupal.org packaging script on 2014-11-19
|
|
8 |
version = "7.x-1.5"
|
|
8 |
; Information added by Drupal.org packaging script on 2015-01-28
|
|
9 |
version = "7.x-1.6"
|
|
9 | 10 |
core = "7.x" |
10 | 11 |
project = "ctools" |
11 |
datestamp = "1416423525"
|
|
12 |
datestamp = "1422471484"
|
|
12 | 13 |
|
drupal7/sites/all/modules/ctools/ctools_plugin_example/ctools_plugin_example.info | ||
---|---|---|
1 | 1 |
name = Chaos Tools (CTools) Plugin Example |
2 | 2 |
description = Shows how an external module can provide ctools plugins (for Panels, etc.). |
3 | 3 |
package = Chaos tool suite |
4 |
version = CTOOLS_MODULE_VERSION |
|
4 | 5 |
dependencies[] = ctools |
5 | 6 |
dependencies[] = panels |
6 | 7 |
dependencies[] = page_manager |
7 | 8 |
dependencies[] = advanced_help |
8 | 9 |
core = 7.x |
9 | 10 |
|
10 |
; Information added by Drupal.org packaging script on 2014-11-19
|
|
11 |
version = "7.x-1.5"
|
|
11 |
; Information added by Drupal.org packaging script on 2015-01-28
|
|
12 |
version = "7.x-1.6"
|
|
12 | 13 |
core = "7.x" |
13 | 14 |
project = "ctools" |
14 |
datestamp = "1416423525"
|
|
15 |
datestamp = "1422471484"
|
|
15 | 16 |
|
drupal7/sites/all/modules/ctools/includes/content.inc | ||
---|---|---|
244 | 244 |
* The content as rendered by the plugin. This content should be an array |
245 | 245 |
* with the following possible keys: |
246 | 246 |
* - title: The safe to render title of the content. |
247 |
* - title_heading: The title heading. |
|
247 | 248 |
* - content: The safe to render HTML content. |
248 | 249 |
* - links: An array of links associated with the content suitable for |
249 | 250 |
* theme('links'). |
... | ... | |
299 | 300 |
$keywords['%title'] = empty($content->title) ? '' : $content->title; |
300 | 301 |
$content->original_title = $keywords['%title']; |
301 | 302 |
$content->title = $conf['override_title_text']; |
303 |
$content->title_heading = isset($conf['override_title_heading']) ? $conf['override_title_heading'] : 'h2'; |
|
302 | 304 |
} |
303 | 305 |
|
304 | 306 |
if (!empty($content->title)) { |
... | ... | |
504 | 506 |
'#size' => 35, |
505 | 507 |
'#id' => 'override-title-textfield', |
506 | 508 |
'#dependency' => array('override-title-checkbox' => array(1)), |
507 |
'#dependency_type' => 'disable',
|
|
509 |
'#dependency_type' => 'hidden',
|
|
508 | 510 |
); |
511 |
$form['override_title_heading'] = array( |
|
512 |
'#type' => 'select', |
|
513 |
'#default_value' => isset($conf['override_title_heading']) ? $conf['override_title_heading'] : 'h2', |
|
514 |
'#options' => array( |
|
515 |
'h1' => t('h1'), |
|
516 |
'h2' => t('h2'), |
|
517 |
'h3' => t('h3'), |
|
518 |
'h4' => t('h4'), |
|
519 |
'h5' => t('h5'), |
|
520 |
'h6' => t('h6'), |
|
521 |
'div' => t('div'), |
|
522 |
'span' => t('span'), |
|
523 |
), |
|
524 |
'#id' => 'override-title-heading', |
|
525 |
'#dependency' => array('override-title-checkbox' => array(1)), |
|
526 |
'#dependency_type' => 'hidden', |
|
527 |
); |
|
528 |
|
|
509 | 529 |
$form['aligner_stop'] = array( |
510 | 530 |
'#markup' => '</div>', |
511 | 531 |
); |
... | ... | |
536 | 556 |
if (isset($form_state['values']['override_title'])) { |
537 | 557 |
$form_state['conf']['override_title'] = $form_state['values']['override_title']; |
538 | 558 |
$form_state['conf']['override_title_text'] = $form_state['values']['override_title_text']; |
559 |
$form_state['conf']['override_title_heading'] = $form_state['values']['override_title_heading']; |
|
539 | 560 |
} |
540 | 561 |
} |
541 | 562 |
|
drupal7/sites/all/modules/ctools/includes/content.menu.inc | ||
---|---|---|
27 | 27 |
if ($string != '') { |
28 | 28 |
global $user; |
29 | 29 |
$entity_info = entity_get_info($type); |
30 |
if ($type == 'node') { |
|
31 |
$entity_info['entity keys']['bundle field'] = 'type'; |
|
32 |
} |
|
30 | 33 |
|
31 | 34 |
// We must query all ids, because if every one of the 10 don't have access |
32 | 35 |
// the user may never be able to autocomplete a node title. |
... | ... | |
56 | 59 |
} |
57 | 60 |
else { |
58 | 61 |
$matches[$result['label'] . " [id: $entity_id]"] = '<span class="autocomplete_title">' . check_plain($result['label']) . '</span>'; |
62 |
$matches[$result['label'] . " [id: $entity_id]"] .= isset($result['bundle field']) ? ' <span class="autocomplete_bundle">(' . check_plain($result['bundle field']) . ')</span>' : ''; |
|
59 | 63 |
} |
60 | 64 |
} |
61 | 65 |
|
... | ... | |
83 | 87 |
$query->fields($base_table, array($entity_info['entity keys']['label'])); |
84 | 88 |
} |
85 | 89 |
|
90 |
// Add bundle field to the query, if it exists. |
|
91 |
if (isset($entity_info['entity keys']['bundle field'])) { |
|
92 |
$query->fields($base_table, array($entity_info['entity keys']['bundle field'])); |
|
93 |
} |
|
94 |
|
|
86 | 95 |
// Add a generic entity access tag to the query. |
87 | 96 |
$query->addTag('ctools'); |
88 | 97 |
|
... | ... | |
131 | 140 |
foreach ($results as $record) { |
132 | 141 |
$options[$record->{$entity_info['entity keys']['id']}] = array( |
133 | 142 |
'label' => isset($entity_info['entity keys']['label']) ? check_plain($record->{$entity_info['entity keys']['label']}) : $record->{$entity_info['entity keys']['id']}, |
143 |
'bundle field' => isset($entity_info['entity keys']['bundle field']) ? check_plain($record->{$entity_info['entity keys']['bundle field']}) : '', |
|
134 | 144 |
); |
135 | 145 |
} |
136 | 146 |
} |
drupal7/sites/all/modules/ctools/includes/context-admin.inc | ||
---|---|---|
416 | 416 |
ctools_cache_operation($mechanism, $cache_key, 'finalize', $object); |
417 | 417 |
|
418 | 418 |
// Very irritating way to update the form for our contexts. |
419 |
$arg_form_state = array( |
|
419 |
$arg_form_state = form_state_defaults() + array(
|
|
420 | 420 |
'values' => array(), |
421 |
'programmed' => FALSE, |
|
422 | 421 |
'process_input' => FALSE, |
423 | 422 |
'complete form' => array(), |
424 | 423 |
); |
425 | 424 |
|
425 |
$rel_form_state = $arg_form_state; |
|
426 |
|
|
426 | 427 |
$arg_form = array( |
427 | 428 |
'#post' => array(), |
428 | 429 |
'#programmed' => FALSE, |
... | ... | |
469 | 470 |
$output = array(); |
470 | 471 |
if (!empty($available_relationships)) { |
471 | 472 |
ctools_context_add_item_table_buttons('relationship', $mechanism, $rel_form, $available_relationships); |
472 |
$rel_form = form_builder('dummy_form_id', $rel_form, $arg_form_state);
|
|
473 |
$rel_form = form_builder('dummy_form_id', $rel_form, $rel_form_state);
|
|
473 | 474 |
$output[] = ajax_command_replace('div#ctools-relationships-table div.buttons', drupal_render($rel_form)); |
474 | 475 |
} |
475 | 476 |
|
... | ... | |
591 | 592 |
$output = array(); |
592 | 593 |
$output[] = ctools_modal_command_dismiss(); |
593 | 594 |
|
595 |
$arg_form_state = form_state_defaults() + array( |
|
596 |
'values' => array(), |
|
597 |
'process_input' => FALSE, |
|
598 |
'complete form' => array(), |
|
599 |
); |
|
600 |
|
|
594 | 601 |
$arg_form = array( |
595 | 602 |
'#post' => array(), |
603 |
'#parents' => array(), |
|
604 |
'#array_parents' => array(), |
|
596 | 605 |
'#programmed' => FALSE, |
597 | 606 |
'#tree' => FALSE, |
598 | 607 |
); |
drupal7/sites/all/modules/ctools/includes/context.inc | ||
---|---|---|
169 | 169 |
|
170 | 170 |
function select($contexts, $context) { |
171 | 171 |
if (!is_array($contexts)) { |
172 |
$contexts = array($contexts); |
|
172 |
if (is_object($contexts) && $contexts instanceof ctools_context) { |
|
173 |
$contexts = array($contexts->id => $contexts); |
|
174 |
} |
|
175 |
else { |
|
176 |
$contexts = array($contexts); |
|
177 |
} |
|
173 | 178 |
} |
174 | 179 |
|
175 | 180 |
// If we had requested a $context but that $context doesn't exist |
... | ... | |
328 | 333 |
$title = $num ? t('Context %count', array('%count' => $num)) : t('Context'); |
329 | 334 |
} |
330 | 335 |
|
331 |
return array(
|
|
336 |
$form = array(
|
|
332 | 337 |
'#type' => 'select', |
333 | 338 |
'#options' => $options, |
334 | 339 |
'#title' => $title, |
335 | 340 |
'#default_value' => $default, |
336 | 341 |
); |
337 | 342 |
} |
343 |
|
|
344 |
return $form; |
|
338 | 345 |
} |
339 | 346 |
|
340 | 347 |
/** |
... | ... | |
1587 | 1594 |
$required_context = isset($plugin['required context']) ? $plugin['required context'] : array(); |
1588 | 1595 |
$context = isset($test['context']) ? $test['context'] : array(); |
1589 | 1596 |
$contexts = ctools_context_select($contexts, $required_context, $context); |
1590 |
$function($test['settings'], $contexts); |
|
1597 |
if ($contexts !== FALSE) { |
|
1598 |
$function($test['settings'], $contexts); |
|
1599 |
} |
|
1591 | 1600 |
} |
1592 | 1601 |
} |
1593 | 1602 |
} |
drupal7/sites/all/modules/ctools/includes/css-cache.inc | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
/** |
|
4 |
* @file |
|
5 |
* Custom cache implementation for the CTools CSS cache. |
|
6 |
*/ |
|
7 |
|
|
8 |
class CToolsCssCache implements DrupalCacheInterface { |
|
9 |
|
|
10 |
/** |
|
11 |
* {@inheritdoc} |
|
12 |
*/ |
|
13 |
public function clear($cid = NULL, $wildcard = FALSE) { |
|
14 |
// Only clear the caches if the wildcard is set, this ensures that the cache |
|
15 |
// is only cleared when the full caches are cleared manually (eg by invoking |
|
16 |
// drupal_flush_all_caches()), and not on a cron run. |
|
17 |
// @see drupal_flush_all_caches() |
|
18 |
// @see system_cron() |
|
19 |
if ($wildcard) { |
|
20 |
ctools_include('css'); |
|
21 |
ctools_css_flush_caches(); |
|
22 |
} |
|
23 |
} |
|
24 |
|
|
25 |
/** |
|
26 |
* {@inheritdoc} |
|
27 |
*/ |
|
28 |
public function get($cid) { |
|
29 |
return FALSE; |
|
30 |
} |
|
31 |
|
|
32 |
/** |
|
33 |
* {@inheritdoc} |
|
34 |
*/ |
|
35 |
public function getMultiple(&$cids) { |
|
36 |
return array(); |
|
37 |
} |
|
38 |
|
|
39 |
/** |
|
40 |
* {@inheritdoc} |
|
41 |
*/ |
|
42 |
public function isEmpty() { |
|
43 |
return FALSE; |
|
44 |
} |
|
45 |
|
|
46 |
/** |
|
47 |
* {@inheritdoc} |
|
48 |
*/ |
|
49 |
public function set($cid, $data, $expire = CACHE_PERMANENT) { |
|
50 |
} |
|
51 |
|
|
52 |
} |
drupal7/sites/all/modules/ctools/includes/fields.inc | ||
---|---|---|
79 | 79 |
$instance = ctools_fields_fake_field_instance($field['field_name'], $view_mode, $formatter_type, $conf['formatter_settings']); |
80 | 80 |
$settings_form = $function($field, $instance, $view_mode, $form, $form_state); |
81 | 81 |
if ($settings_form) { |
82 |
// Allow other modules to alter the formatter settings form. |
|
83 |
$context = array( |
|
84 |
'module' => $formatter['module'], |
|
85 |
'formatter' => $formatter, |
|
86 |
'field' => $field, |
|
87 |
'instance' => $instance, |
|
88 |
'view_mode' => $view_mode, |
|
89 |
'form' => $form, |
|
90 |
'form_state' => $form_state, |
|
91 |
); |
|
92 |
drupal_alter('field_formatter_settings_form', $settings_form, $context); |
|
93 |
|
|
94 |
$settings_form['#tree'] = TRUE; |
|
82 | 95 |
$form['ctools_field_list']['#value'][] = $field; |
83 | 96 |
$form += $settings_form; |
84 | 97 |
} |
drupal7/sites/all/modules/ctools/includes/modal.inc | ||
---|---|---|
187 | 187 |
/** |
188 | 188 |
* Wrap a form so that we can use it properly with AJAX. Essentially if the |
189 | 189 |
* form wishes to render, it automatically does that, otherwise it returns |
190 |
* so we can see submission results. |
|
190 |
* the render array so we can see submission results.
|
|
191 | 191 |
|
192 | 192 |
* @param array $form |
193 | 193 |
* An associative array containing the structure of the form. |
... | ... | |
201 | 201 |
* is set, this will use ctools_modal_form_render so it will be |
202 | 202 |
* a $command object suitable for ajax_render already. |
203 | 203 |
* |
204 |
* The return will be NULL if the form was successfully submitted unless
|
|
205 |
* you specifically set re_render = TRUE. If ajax is set the
|
|
206 |
* form will never be redirected. |
|
204 |
* If the form was not rendered, the raw render array will be returned.
|
|
205 |
* |
|
206 |
* If ajax is set the form will never be redirected.
|
|
207 | 207 |
*/ |
208 | 208 |
function ctools_modal_form_wrapper($form_id, &$form_state) { |
209 | 209 |
// Since this will run again on form rebuild while still in the modal, prevent |
... | ... | |
220 | 220 |
); |
221 | 221 |
|
222 | 222 |
$output = drupal_build_form($form_id, $form_state); |
223 |
if (!empty($form_state['ajax']) && (!$form_state['executed'] || $form_state['rebuild'])) { |
|
223 |
if (!empty($form_state['ajax']) && (!$form_state['executed'] || $form_state['rebuild'])) {
|
|
224 | 224 |
return ctools_modal_form_render($form_state, $output); |
225 | 225 |
} |
226 | 226 |
|
drupal7/sites/all/modules/ctools/includes/plugins.inc | ||
---|---|---|
214 | 214 |
function ctools_get_plugins($module, $type, $id = NULL) { |
215 | 215 |
// Store local caches of plugins and plugin info so we don't have to do full |
216 | 216 |
// lookups everytime. |
217 |
$plugins = &drupal_static('ctools_plugins', array()); |
|
217 |
static $drupal_static_fast; |
|
218 |
if (!isset($drupal_static_fast)) { |
|
219 |
$drupal_static_fast['plugins'] = &drupal_static('ctools_plugins', array()); |
|
220 |
} |
|
221 |
$plugins = &$drupal_static_fast['plugins']; |
|
222 |
|
|
218 | 223 |
$info = ctools_plugin_get_plugin_type_info(); |
219 | 224 |
|
220 | 225 |
// Bail out noisily if an invalid module/type combination is requested. |
... | ... | |
423 | 428 |
// store static of plugin arrays for reference because they can't be reincluded. |
424 | 429 |
static $plugin_arrays = array(); |
425 | 430 |
|
426 |
// If we're being asked for all plugins of a type, skip any caching |
|
427 |
// we may have done because this is an admin task and it's ok to |
|
428 |
// spend the extra time. |
|
429 |
if (!isset($filename)) { |
|
430 |
$all_files[$info['module']][$info['type']] = NULL; |
|
431 |
} |
|
432 |
|
|
433 | 431 |
if (!isset($all_files[$info['module']][$info['type']])) { |
434 |
// If a filename was set, we will try to load our list of files from |
|
435 |
// cache. This is considered normal operation and we try to reduce |
|
436 |
// the time spent finding files. |
|
437 |
if (isset($filename)) { |
|
438 |
$cache = cache_get("ctools_plugin_files:$info[module]:$info[type]"); |
|
439 |
if ($cache) { |
|
440 |
$all_files[$info['module']][$info['type']] = $cache->data; |
|
441 |
} |
|
442 |
} |
|
443 |
|
|
444 |
if (!isset($all_files[$info['module']][$info['type']])) { |
|
432 |
$cache = cache_get("ctools_plugin_files:$info[module]:$info[type]"); |
|
433 |
if ($cache) { |
|
434 |
$all_files[$info['module']][$info['type']] = $cache->data; |
|
435 |
} |
|
436 |
// Do not attempt any file scan even if the cached entry was empty. |
|
437 |
// A NULL entry here would mean the plugin just does not exists, and we |
|
438 |
// cannot afford to run file scan on production sites normal run. |
|
439 |
elseif (!isset($all_files[$info['module']][$info['type']])) { |
|
445 | 440 |
$all_files[$info['module']][$info['type']] = array(); |
446 | 441 |
// Load all our plugins. |
447 | 442 |
$directories = ctools_plugin_get_directories($info); |
... | ... | |
683 | 678 |
if (!function_exists($function)) { |
684 | 679 |
return NULL; |
685 | 680 |
} |
686 |
$result = $function(); |
|
681 |
$result = $function($info);
|
|
687 | 682 |
if (!isset($result) || !is_array($result)) { |
688 | 683 |
return NULL; |
689 | 684 |
} |
drupal7/sites/all/modules/ctools/includes/wizard.inc | ||
---|---|---|
274 | 274 |
if (!empty($form_info['show trail'])) { |
275 | 275 |
ctools_add_css('wizard'); |
276 | 276 |
$form['ctools_trail'] = array( |
277 |
'#markup' => theme(array('ctools_wizard_trail__' . $form_info['id'], 'ctools_wizard_trail'), array('trail' => $trail)), |
|
277 |
'#markup' => theme(array('ctools_wizard_trail__' . $form_info['id'], 'ctools_wizard_trail'), array('trail' => $trail, 'form_info' => $form_info)),
|
|
278 | 278 |
'#weight' => -1000, |
279 | 279 |
); |
280 | 280 |
} |
drupal7/sites/all/modules/ctools/includes/wizard.theme.inc | ||
---|---|---|
7 | 7 |
|
8 | 8 |
function ctools_wizard_theme(&$theme) { |
9 | 9 |
$theme['ctools_wizard_trail'] = array( |
10 |
'variables' => array('trail' => NULL), |
|
10 |
'variables' => array('trail' => NULL, 'form_info' => NULL, 'divider' => ' » '),
|
|
11 | 11 |
'file' => 'includes/wizard.theme.inc', |
12 | 12 |
); |
13 | 13 |
} |
14 | 14 |
|
15 | 15 |
/** |
16 |
* Themable display of the 'breadcrumb' trail to show the order of the |
|
17 |
* forms. |
|
16 |
* Themable display of the 'breadcrumb' trail to show the order of the forms. |
|
18 | 17 |
*/ |
19 | 18 |
function theme_ctools_wizard_trail($vars) { |
20 |
$trail = $vars['trail']; |
|
21 |
if (!empty($trail)) { |
|
22 |
return '<div class="wizard-trail">' . implode(' » ', $trail) . '</div>'; |
|
19 |
if (!empty($vars['trail'])) { |
|
20 |
return '<div class="wizard-trail">' . implode($vars['divider'], $vars['trail']) . '</div>'; |
|
23 | 21 |
} |
24 | 22 |
} |
25 |
|
drupal7/sites/all/modules/ctools/js/dependent.js | ||
---|---|---|
40 | 40 |
Drupal.CTools.dependent.autoAttach = function() { |
41 | 41 |
// Clear active bindings and triggers. |
42 | 42 |
for (i in Drupal.CTools.dependent.activeTriggers) { |
43 |
$(Drupal.CTools.dependent.activeTriggers[i]).unbind('change'); |
|
43 |
$(Drupal.CTools.dependent.activeTriggers[i]).unbind('change.ctools-dependent');
|
|
44 | 44 |
} |
45 | 45 |
Drupal.CTools.dependent.activeTriggers = []; |
46 | 46 |
Drupal.CTools.dependent.activeBindings = {}; |
... | ... | |
194 | 194 |
} |
195 | 195 |
} |
196 | 196 |
|
197 |
$(trigger_id).change(function() {
|
|
197 |
$(trigger_id).bind('change.ctools-dependent', function() {
|
|
198 | 198 |
// Trigger the internal change function |
199 | 199 |
// the attr('id') is used because closures are more confusing |
200 | 200 |
changeTrigger(trigger_id, bind_id); |
... | ... | |
215 | 215 |
// is a sort of hacked one that's faster but much less flexible. |
216 | 216 |
$("select.ctools-master-dependent") |
217 | 217 |
.once('ctools-dependent') |
218 |
.change(function() {
|
|
218 |
.bind('change.ctools-dependent', function() {
|
|
219 | 219 |
var val = $(this).val(); |
220 | 220 |
if (val == 'all') { |
221 | 221 |
$('.ctools-dependent-all').show(0); |
... | ... | |
225 | 225 |
$('.ctools-dependent-' + val).show(0); |
226 | 226 |
} |
227 | 227 |
}) |
228 |
.trigger('change'); |
|
228 |
.trigger('change.ctools-dependent');
|
|
229 | 229 |
} |
230 | 230 |
} |
231 | 231 |
})(jQuery); |
drupal7/sites/all/modules/ctools/js/modal.js | ||
---|---|---|
379 | 379 |
css.filter = 'alpha(opacity=' + (100 * css.opacity) + ')'; |
380 | 380 |
content.hide(); |
381 | 381 |
|
382 |
// if we already ahve a modalContent, remove it
|
|
383 |
if ( $('#modalBackdrop')) $('#modalBackdrop').remove();
|
|
384 |
if ( $('#modalContent')) $('#modalContent').remove();
|
|
382 |
// If we already have modalContent, remove it.
|
|
383 |
if ($('#modalBackdrop').length) $('#modalBackdrop').remove();
|
|
384 |
if ($('#modalContent').length) $('#modalContent').remove();
|
|
385 | 385 |
|
386 | 386 |
// position code lifted from http://www.quirksmode.org/viewport/compatibility.html |
387 | 387 |
if (self.pageYOffset) { // all except Explorer |
... | ... | |
421 | 421 |
return true; |
422 | 422 |
} |
423 | 423 |
} |
424 |
if( $(target).filter('*:visible').parents('#modalContent').size()) { |
|
425 |
// allow the event only if target is a visible child node of #modalContent |
|
424 |
|
|
425 |
if ($(target).is('#modalContent, body') || $(target).filter('*:visible').parents('#modalContent').length) { |
|
426 |
// Allow the event only if target is a visible child node |
|
427 |
// of #modalContent. |
|
426 | 428 |
return true; |
427 | 429 |
} |
428 |
if ( $('#modalContent')) $('#modalContent').get(0).focus(); |
|
429 |
return false; |
|
430 |
else { |
|
431 |
$('#modalContent').focus(); |
|
432 |
} |
|
433 |
|
|
434 |
event.preventDefault(); |
|
430 | 435 |
}; |
431 | 436 |
$('body').bind( 'focus', modalEventHandler ); |
432 | 437 |
$('body').bind( 'keypress', modalEventHandler ); |
... | ... | |
477 | 482 |
|
478 | 483 |
// Move and resize the modalBackdrop and modalContent on resize of the window |
479 | 484 |
modalContentResize = function(){ |
485 |
|
|
486 |
// position code lifted from http://www.quirksmode.org/viewport/compatibility.html |
|
487 |
if (self.pageYOffset) { // all except Explorer |
|
488 |
var wt = self.pageYOffset; |
|
489 |
} else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict |
|
490 |
var wt = document.documentElement.scrollTop; |
|
491 |
} else if (document.body) { // all other Explorers |
|
492 |
var wt = document.body.scrollTop; |
|
493 |
} |
|
494 |
|
|
480 | 495 |
// Get our heights |
481 | 496 |
var docHeight = $(document).height(); |
482 | 497 |
var docWidth = $(document).width(); |
... | ... | |
486 | 501 |
|
487 | 502 |
// Get where we should move content to |
488 | 503 |
var modalContent = $('#modalContent'); |
489 |
var mdcTop = ( winHeight / 2 ) - ( modalContent.outerHeight() / 2);
|
|
504 |
var mdcTop = wt + ( winHeight / 2 ) - ( modalContent.outerHeight() / 2);
|
|
490 | 505 |
var mdcLeft = ( winWidth / 2 ) - ( modalContent.outerWidth() / 2); |
491 | 506 |
|
492 | 507 |
// Apply the changes |
drupal7/sites/all/modules/ctools/page_manager/page_manager.admin.inc | ||
---|---|---|
95 | 95 |
|
96 | 96 |
$header = array( |
97 | 97 |
array('data' => t('Type'), 'class' => array('page-manager-page-type')), |
98 |
array('data' => t('Module'), 'class' => array('page-manager-page-module')), |
|
98 | 99 |
array('data' => t('Name'), 'class' => array('page-manager-page-name')), |
99 | 100 |
array('data' => t('Title'), 'class' => array('page-manager-page-title')), |
100 | 101 |
array('data' => t('Path'), 'class' => array('page-manager-page-path')), |
... | ... | |
175 | 176 |
$row = array('data' => array(), 'class' => $class, 'title' => strip_tags($task['admin description'])); |
176 | 177 |
|
177 | 178 |
$type = isset($task['admin type']) ? $task['admin type'] : t('System'); |
179 |
if (isset($task['module'])) { |
|
180 |
$module = $task['module']; |
|
181 |
} |
|
182 |
elseif (isset($task['subtask']->export_module)) { |
|
183 |
$module = $task['subtask']->export_module; |
|
184 |
} |
|
185 |
else { |
|
186 |
$module = ''; |
|
187 |
} |
|
178 | 188 |
$pages['types'][$type] = $type; |
179 | 189 |
$row['data']['type'] = array('data' => $type, 'class' => array('page-manager-page-type')); |
180 |
|
|
190 |
$row['data']['module'] = array('data' => $module, 'class' => array('page-manager-page-module')); |
|
181 | 191 |
$row['data']['name'] = array('data' => $task_name, 'class' => array('page-manager-page-name')); |
182 | 192 |
$row['data']['title'] = array('data' => $task['admin title'], 'class' => array('page-manager-page-title')); |
183 | 193 |
$row['data']['path'] = array('data' => $visible_path, 'class' => array('page-manager-page-path')); |
... | ... | |
401 | 411 |
* Render the edit page for a a page, custom or system. |
402 | 412 |
*/ |
403 | 413 |
function page_manager_edit_page($page) { |
404 |
drupal_set_title($page->subtask['admin title']); |
|
414 |
drupal_set_title($page->subtask['admin title'], PASS_THROUGH);
|
|
405 | 415 |
// Provide and process the save page form before anything else. |
406 | 416 |
$form_state = array('page' => &$page); |
407 | 417 |
$built_form = drupal_build_form('page_manager_save_page_form', $form_state); |
... | ... | |
464 | 474 |
return; |
465 | 475 |
} |
466 | 476 |
|
467 |
drupal_set_title($page->subtask['admin title']); |
|
477 |
drupal_set_title($page->subtask['admin title'], PASS_THROUGH);
|
|
468 | 478 |
return $output; |
469 | 479 |
} |
470 | 480 |
|
... | ... | |
577 | 587 |
), |
578 | 588 |
); |
579 | 589 |
|
580 |
// Restrict variant import to users who can already execute arbitrary PHP
|
|
581 |
if (user_access('use PHP for settings')) {
|
|
590 |
// Restrict variant import due to security implications.
|
|
591 |
if (user_access('use ctools import')) {
|
|
582 | 592 |
$result['actions']['children']['import'] = array( |
583 | 593 |
'title' => t('Import variant'), |
584 | 594 |
'description' => t('Add a new variant to this page from code exported from another page.'), |
... | ... | |
1308 | 1318 |
else { |
1309 | 1319 |
$handler->conf['title'] = $plugin['title']; |
1310 | 1320 |
} |
1321 |
$handler->conf['name'] = $form_state['values']['name']; |
|
1311 | 1322 |
$cache->new_handler = $handler; |
1312 | 1323 |
|
1313 | 1324 |
// Figure out which forms to present them with |
... | ... | |
1398 | 1409 |
'#title' => t('Title'), |
1399 | 1410 |
'#description' => t('Administrative title of this variant. If you leave blank it will be automatically assigned.'), |
1400 | 1411 |
); |
1412 |
|
|
1413 |
$form['name'] = array( |
|
1414 |
'#type' => 'machine_name', |
|
1415 |
'#title' => t('Machine name'), |
|
1416 |
'#required' => FALSE, |
|
1417 |
'#description' => t("A unique machine-readable name for this variant. It must only contain lowercase letters, numbers, and underscores. This name will be used when exporting the variant. If left empty the variant's name will be used instead."), |
|
1418 |
'#size' => 32, |
|
1419 |
'#maxlength' => 32, |
|
1420 |
'#machine_name' => array( |
|
1421 |
'exists' => 'page_manager_handler_check_machine_name', |
|
1422 |
'source' => array('title'), |
|
1423 |
), |
|
1424 |
'#field_prefix' => '<span dir="ltr">' . $task['name'] . '__', |
|
1425 |
'#field_suffix' => '</span>‎', |
|
1426 |
); |
|
1401 | 1427 |
} |
1402 | 1428 |
|
1403 | 1429 |
$form['handler'] = array( |
... | ... | |
1436 | 1462 |
return $form; |
1437 | 1463 |
} |
1438 | 1464 |
|
1465 |
/* |
|
1466 |
* Check if handler's machine-name is unique |
|
1467 |
*/ |
|
1468 |
function page_manager_handler_check_machine_name($name, $element, $form_state) { |
|
1469 |
$name = $form_state['task']['name'] . '__' . $name; |
|
1470 |
|
|
1471 |
return count(ctools_export_load_object('page_manager_handlers', 'names', array($name))); |
|
1472 |
} |
|
1473 |
|
|
1439 | 1474 |
/** |
1440 | 1475 |
* Rearrange the order of variants. |
1441 | 1476 |
*/ |
... | ... | |
1446 | 1481 |
'#description' => t('Enter the name of the new variant.'), |
1447 | 1482 |
); |
1448 | 1483 |
|
1449 |
if (user_access('use PHP for settings')) {
|
|
1484 |
if (user_access('use ctools import')) {
|
|
1450 | 1485 |
$form['object'] = array( |
1451 | 1486 |
'#type' => 'textarea', |
1452 | 1487 |
'#title' => t('Paste variant code here'), |
1453 | 1488 |
'#rows' => 15, |
1454 | 1489 |
); |
1455 | 1490 |
} |
1456 |
// Users ordinarily can't get here without the PHP block visibility perm. |
|
1457 |
// In case they somehow do, though, disable the form widget for extra safety. |
|
1491 |
// Users ordinarily can't get here without the 'import' permission, due to |
|
1492 |
// security implications. In case they somehow do, though, disable the form |
|
1493 |
// widget for extra safety. |
|
1458 | 1494 |
else { |
1459 | 1495 |
$form['shoveoff'] = array( |
1460 | 1496 |
'#markup' => '<div>' . t('You do not have sufficient permissions to perform this action.') . '</div>', |
... | ... | |
1468 | 1504 |
* Make sure that an import actually provides a handler. |
1469 | 1505 |
*/ |
1470 | 1506 |
function page_manager_handler_import_validate($form, &$form_state) { |
1471 |
if (!user_access('use PHP for settings')) {
|
|
1507 |
if (!user_access('use ctools import')) {
|
|
1472 | 1508 |
form_error($form['shoveoff'], t('You account permissions do not permit you to import.')); |
1473 | 1509 |
return; |
1474 | 1510 |
} |
drupal7/sites/all/modules/ctools/page_manager/page_manager.info | ||
---|---|---|
3 | 3 |
core = 7.x |
4 | 4 |
dependencies[] = ctools |
5 | 5 |
package = Chaos tool suite |
6 |
version = CTOOLS_MODULE_VERSION |
|
6 | 7 |
|
7 |
; Information added by Drupal.org packaging script on 2014-11-19
|
|
8 |
version = "7.x-1.5"
|
|
8 |
; Information added by Drupal.org packaging script on 2015-01-28
|
|
9 |
version = "7.x-1.6"
|
|
9 | 10 |
core = "7.x" |
10 | 11 |
project = "ctools" |
11 |
datestamp = "1416423525"
|
|
12 |
datestamp = "1422471484"
|
|
12 | 13 |
|
drupal7/sites/all/modules/ctools/page_manager/page_manager.module | ||
---|---|---|
213 | 213 |
} |
214 | 214 |
} |
215 | 215 |
|
216 |
// Override the core node revisions display to use the configured Page |
|
217 |
// display handler. |
|
218 |
if (!variable_get('page_manager_node_view_disabled', TRUE) && isset($items['node/%node/revisions/%/view'])) { |
|
219 |
// Abstract the basic settings. |
|
220 |
$item = array( |
|
221 |
// Handle the page arguments. |
|
222 |
'load arguments' => array(3), |
|
223 |
'page arguments' => array(1, TRUE), |
|
224 |
|
|
225 |
// Replace the normal node_show call with Page Manager's node view. |
|
226 |
'page callback' => 'page_manager_node_view_page', |
|
227 |
|
|
228 |
// Provide the correct path to the Page Manager file. |
|
229 |
'file' => 'node_view.inc', |
|
230 |
'file path' => drupal_get_path('module', 'page_manager') . '/plugins/tasks', |
|
231 |
); |
|
232 |
// Re-build the menu item using the normal values from node.module. |
|
233 |
$items['node/%node/revisions/%/view'] = array( |
|
234 |
'title' => 'Revisions', |
|
235 |
'access callback' => '_node_revision_access', |
|
236 |
'access arguments' => array(1), |
|
237 |
) + $item; |
|
238 |
} |
|
239 |
|
|
216 | 240 |
return $items; |
217 | 241 |
} |
218 | 242 |
|
... | ... | |
416 | 440 |
*/ |
417 | 441 |
function page_manager_handler_get_name($task_name, $handlers, $handler) { |
418 | 442 |
$base = str_replace('-', '_', $task_name); |
419 |
// Generate a unique name. Unlike most named objects, we don't let people choose |
|
420 |
// names for task handlers because they mostly don't make sense. |
|
421 |
$base .= '_' . $handler->handler; |
|
422 |
|
|
423 |
// Once we have a base, check to see if it is used. If it is, start counting up. |
|
424 |
$name = $base; |
|
425 |
$count = 1; |
|
426 |
// If taken |
|
427 |
while (isset($handlers[$name])) { |
|
428 |
$name = $base . '_' . ++$count; |
|
443 |
// Optional machine name. |
|
444 |
if (!empty($handler->conf['name'])) { |
|
445 |
$name = $base . '__' . $handler->conf['name']; |
|
446 |
} |
|
447 |
|
|
448 |
// If no machine name was provided, generate a unique name. |
|
449 |
else { |
|
450 |
$base .= '__' . $handler->handler; |
|
451 |
|
|
452 |
// Use the ctools uuid generator to generate a unique id. |
|
453 |
$name = $base . '_' . ctools_uuid_generate(); |
|
429 | 454 |
} |
430 | 455 |
|
431 | 456 |
return $name; |
drupal7/sites/all/modules/ctools/page_manager/plugins/task_handlers/http_response.inc | ||
---|---|---|
224 | 224 |
'#description' => t('Administrative title of this variant.'), |
225 | 225 |
); |
226 | 226 |
|
227 |
$name = isset($conf['name']) ? $conf['name'] : FALSE; |
|
228 |
$form['name'] = array( |
|
229 |
'#type' => 'machine_name', |
|
230 |
'#title' => t('Machine name'), |
|
231 |
'#required' => FALSE, |
|
232 |
'#default_value' => $name, |
|
233 |
'#description' => t("A unique machine-readable name for this variant. It must only contain lowercase letters, numbers, and underscores. This name will be used when exporting the variant. If left empty the variant's name will be used instead."), |
|
234 |
'#size' => 32, |
|
235 |
'#maxlength' => 32, |
|
236 |
'#machine_name' => array( |
|
237 |
'exists' => 'page_manager_handler_check_machine_name', |
|
238 |
'source' => array('title'), |
|
239 |
), |
|
240 |
'#field_prefix' => '<span dir="ltr">' . $form_state['task_name'] . '__', |
|
241 |
'#field_suffix' => '</span>‎', |
|
242 |
); |
|
243 |
|
|
227 | 244 |
$form['code'] = array( |
228 | 245 |
'#title' => t('Response code'), |
229 | 246 |
'#type' => 'select', |
... | ... | |
244 | 261 |
} |
245 | 262 |
|
246 | 263 |
function page_manager_http_response_edit_settings_submit($form, &$form_state) { |
264 |
$machine_name = $form_state['handler']->name; |
|
265 |
$name = $form_state['task_id'] . '__' . $form_state['values']['name']; |
|
266 |
|
|
267 |
// If new name doesn't equal machine name, we need to update and redirect. |
|
268 |
if ($machine_name !== $name) { |
|
269 |
$form_state['new trail'] = $form_state['trail']; |
|
270 |
$delta = array_search($machine_name, $form_state['new trail']); |
|
271 |
$form_state['new trail'][$delta] = $name; |
|
272 |
$form_state['handler']->name = $name; |
|
273 |
} |
|
274 |
|
|
247 | 275 |
$form_state['handler']->conf['title'] = $form_state['values']['title']; |
276 |
$form_state['handler']->conf['name'] = $form_state['values']['name']; |
|
248 | 277 |
$form_state['handler']->conf['code'] = $form_state['values']['code']; |
249 | 278 |
$form_state['handler']->conf['destination'] = $form_state['values']['destination']; |
250 | 279 |
} |
drupal7/sites/all/modules/ctools/page_manager/plugins/tasks/comment_reply.inc | ||
---|---|---|
67 | 67 |
} |
68 | 68 |
|
69 | 69 |
$output = ctools_context_handler_render($task, '', $contexts, array($node, $pid)); |
70 |
if ($output != FALSE) { |
|
70 |
if ($output !== FALSE) {
|
|
71 | 71 |
return $output; |
72 | 72 |
} |
73 | 73 |
|
drupal7/sites/all/modules/ctools/page_manager/plugins/tasks/node_edit.inc | ||
---|---|---|
126 | 126 |
'language' => LANGUAGE_NONE, |
127 | 127 |
); |
128 | 128 |
|
129 |
drupal_set_title(t('Create @name', array('@name' => $types[$type]->name))); |
|
129 |
drupal_set_title(t('Create @name', array('@name' => $types[$type]->name)), PASS_THROUGH);
|
|
130 | 130 |
return page_manager_node_edit($node); |
131 | 131 |
} |
132 | 132 |
|
drupal7/sites/all/modules/ctools/page_manager/plugins/tasks/node_view.inc | ||
---|---|---|
78 | 78 |
* node view, which is node_page_view(). |
79 | 79 |
*/ |
80 | 80 |
function page_manager_node_view_page($node) { |
81 |
// Prep the node to be displayed so all of the regular hooks are triggered. |
|
82 |
// Also save the output for later, in case it is needed. |
|
83 |
$default_output = node_page_view($node); |
|
84 |
|
|
81 | 85 |
// Load my task plugin |
82 | 86 |
$task = page_manager_get_task('node_view'); |
83 | 87 |
|
... | ... | |
85 | 89 |
ctools_include('context'); |
86 | 90 |
ctools_include('context-task-handler'); |
87 | 91 |
|
88 |
// We need to mimic Drupal's behavior of setting the node title here. |
|
89 |
drupal_set_title($node->title); |
|
90 |
$uri = entity_uri('node', $node); |
|
91 |
// Set the node path as the canonical URL to prevent duplicate content. |
|
92 |
drupal_add_html_head_link(array('rel' => 'canonical', 'href' => url($uri['path'], $uri['options'])), TRUE); |
|
93 |
// Set the non-aliased path as a default shortlink. |
|
94 |
drupal_add_html_head_link(array('rel' => 'shortlink', 'href' => url($uri['path'], array_merge($uri['options'], array('alias' => TRUE)))), TRUE); |
|
92 |
// Load all contexts. |
|
95 | 93 |
$contexts = ctools_context_handler_get_task_contexts($task, '', array($node)); |
96 | 94 |
|
95 |
// Build the full output using the configured CTools plugin. |
|
97 | 96 |
$output = ctools_context_handler_render($task, '', $contexts, array($node->nid)); |
98 |
if ($output != FALSE) { |
|
97 |
if ($output !== FALSE) {
|
|
99 | 98 |
node_tag_new($node); |
100 | 99 |
return $output; |
101 | 100 |
} |
102 | 101 |
|
103 |
$function = 'node_page_view';
|
|
102 |
// Try loading an override plugin.
|
|
104 | 103 |
foreach (module_implements('page_manager_override') as $module) { |
105 | 104 |
$call = $module . '_page_manager_override'; |
106 | 105 |
if (($rc = $call('node_view')) && function_exists($rc)) { |
107 |
$function = $rc; |
|
108 |
break; |
|
106 |
return $rc($node); |
|
109 | 107 |
} |
110 | 108 |
} |
111 | 109 |
|
112 |
// Otherwise, fall back. |
|
113 |
return $function($node);
|
|
110 |
// Otherwise, fall back to the default output generated by node_page_view().
|
|
111 |
return $default_output;
|
|
114 | 112 |
} |
115 | 113 |
|
116 | 114 |
/** |
drupal7/sites/all/modules/ctools/page_manager/plugins/tasks/page.admin.inc | ||
---|---|---|
38 | 38 |
) + $base; |
39 | 39 |
if ($access_callback == 'user_access') { |
40 | 40 |
$items['admin/structure/pages/import']['access callback'] = 'ctools_access_multiperm'; |
41 |
$items['admin/structure/pages/import']['access arguments'][] = 'use PHP for settings';
|
|
41 |
$items['admin/structure/pages/import']['access arguments'][] = 'use ctools import';
|
|
42 | 42 |
} |
43 | 43 |
|
44 | 44 |
// AJAX callbacks for argument modal. |
... | ... | |
769 | 769 |
); |
770 | 770 |
} |
771 | 771 |
$form['menu']['parent']['weight'] = array( |
772 |
'#title' => t('Tab weight'),
|
|
772 |
'#title' => t('Parent weight'),
|
|
773 | 773 |
'#type' => 'textfield', |
774 | 774 |
'#default_value' => $menu['parent']['weight'], |
775 | 775 |
'#size' => 5, |
776 |
'#description' => t('If the parent menu item is a tab, enter the weight of the tab. The lower the number, the more to the left it will be.'),
|
|
777 |
'#dependency' => array('radio:menu[type]' => array('default tab'), 'radio:menu[parent][type]' => array('tab')), |
|
776 |
'#description' => t('Enter the weight of the parent item. The lower the number, the more to the left it will be.'),
|
|
777 |
'#dependency' => array('radio:menu[type]' => array('default tab'), 'radio:menu[parent][type]' => array('tab', 'normal')),
|
|
778 | 778 |
'#dependency_count' => 2, |
779 | 779 |
); |
780 | 780 |
|
drupal7/sites/all/modules/ctools/page_manager/plugins/tasks/user_edit.inc | ||
---|---|---|
97 | 97 |
$output = ctools_context_handler_render($task, '', $contexts, array($account->uid)); |
98 | 98 |
if (is_array($output)) { |
99 | 99 |
$output = drupal_render($output); |
100 |
}
|
|
101 |
if ($output != FALSE) { |
|
100 |
} |
|
101 |
if ($output !== FALSE) {
|
|
102 | 102 |
return $output; |
103 | 103 |
} |
104 | 104 |
|
... | ... | |
119 | 119 |
//call drupal_build_form. |
120 | 120 |
$form_state = array(); |
121 | 121 |
$form_id = 'user_profile_form'; |
122 |
$args = array($account); |
|
122 |
$args = array($account, $category);
|
|
123 | 123 |
$form_state['build_info']['args'] = $args; |
124 | 124 |
form_load_include($form_state, 'inc', 'user', 'user.pages'); |
125 | 125 |
$output = drupal_build_form($form_id, $form_state); |
drupal7/sites/all/modules/ctools/page_manager/plugins/tasks/user_view.inc | ||
---|---|---|
81 | 81 |
user_build_content($account); |
82 | 82 |
|
83 | 83 |
$output = ctools_context_handler_render($task, '', $contexts, array($account->uid)); |
84 |
if ($output != FALSE) { |
|
84 |
if ($output !== FALSE) {
|
|
85 | 85 |
return $output; |
86 | 86 |
} |
87 | 87 |
|
drupal7/sites/all/modules/ctools/plugins/access/book.inc | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
/** |
|
4 |
* @file |
|
5 |
* Plugin to provide access control based on whether a node belongs to a book. |
|
6 |
*/ |
|
7 |
|
|
8 |
/** |
|
9 |
* Plugins are described by creating a $plugin array which will be used |
|
10 |
* by the system that includes this file. |
|
11 |
*/ |
|
12 |
if (module_exists('book')) { |
|
13 |
$plugin = array( |
|
14 |
'title' => t("Book: node is in a book"), |
|
15 |
'description' => t('Control access based upon a node belonging to a book.'), |
|
16 |
'callback' => 'ctools_book_node_ctools_access_check', |
|
17 |
'default' => array('book' => array()), |
|
18 |
'settings form' => 'ctools_book_node_ctools_access_settings', |
|
19 |
'settings form submit' => 'ctools_book_node_ctools_access_settings_submit', |
|
20 |
'summary' => 'ctools_book_node_ctools_access_summary', |
|
21 |
'required context' => new ctools_context_required(t('Node'), 'node'), |
|
22 |
); |
|
23 |
} |
|
24 |
|
|
25 |
/** |
|
26 |
* Settings form for the 'by book_node' access plugin. |
|
27 |
*/ |
|
28 |
function ctools_book_node_ctools_access_settings($form, &$form_state, $conf) { |
|
29 |
$options = array( |
|
30 |
'any' => t('In any book'), |
|
31 |
); |
|
32 |
$books = book_get_books(); |
|
33 |
foreach ($books as $bid => $book) { |
|
34 |
$options[$bid] = $book['title']; |
|
35 |
} |
|
36 |
$form['settings']['book'] = array( |
|
37 |
'#title' => t('Book'), |
|
38 |
'#type' => 'checkboxes', |
|
39 |
'#options' => $options, |
|
40 |
'#description' => t('Pass only if the node belongs to one of the selected books'), |
|
41 |
'#default_value' => $conf['book'], |
|
42 |
'#required' => TRUE, |
|
43 |
); |
|
44 |
return $form; |
|
45 |
} |
|
46 |
|
|
47 |
/** |
|
48 |
* Check for access. |
|
49 |
*/ |
|
50 |
function ctools_book_node_ctools_access_check($conf, $context) { |
|
51 |
// As far as I know there should always be a context at this point, but this |
|
52 |
// is safe. |
|
53 |
if (empty($context) || empty($context->data) || empty($context->data->book)) { |
|
54 |
return FALSE; |
|
55 |
} |
|
56 |
|
|
57 |
if ($conf['book']['any']) { |
|
58 |
return !empty($context->data->book); |
|
59 |
} |
|
60 |
|
|
61 |
foreach ($conf['book'] as $bid => $value) { |
|
62 |
if ($bid == 'any') { |
|
63 |
continue; |
|
64 |
} |
|
65 |
if ($value && ($bid == $context->data->book['bid'])) { |
|
66 |
return TRUE; |
|
67 |
} |
|
68 |
} |
|
69 |
|
|
70 |
return FALSE; |
|
71 |
} |
|
72 |
|
|
73 |
/** |
|
74 |
* Provide a summary description based upon the checked node_languages. |
|
75 |
*/ |
|
76 |
function ctools_book_node_ctools_access_summary($conf, $context) { |
|
77 |
if ($conf['book']['any']) { |
|
78 |
return t('@identifier belongs to a book', array('@identifier' => $context->identifier)); |
|
79 |
} |
|
80 |
|
|
81 |
$books = array(); |
|
82 |
foreach ($conf['book'] as $bid => $value) { |
|
83 |
if ($value) { |
|
84 |
$node = node_load($bid); |
|
85 |
$books[] = $node->title; |
|
86 |
} |
|
87 |
} |
|
88 |
|
|
89 |
if (count($books) == 1) { |
|
90 |
return t('@identifier belongs to the book "@book"', array('@book' => $books[0], '@identifier' => $context->identifier)); |
|
91 |
} |
|
92 |
|
|
93 |
return t('@identifier belongs in multiple books', array('@identifier' => $context->identifier)); |
|
94 |
} |
drupal7/sites/all/modules/ctools/plugins/access/entity_field_value.inc | ||
---|---|---|
16 | 16 |
'get child' => 'ctools_entity_field_value_ctools_access_get_child', |
17 | 17 |
'get children' => 'ctools_entity_field_value_ctools_access_get_children', |
18 | 18 |
); |
19 |
function ctools_entity_field_value_ctools_access_get_child($plugin, $parent, $child) { |
|
20 | 19 |
|
20 |
function ctools_entity_field_value_ctools_access_get_child($plugin, $parent, $child) { |
|
21 | 21 |
$plugins = &drupal_static(__FUNCTION__, array()); |
22 | 22 |
if (empty($plugins[$parent . ':' . $child])) { |
23 | 23 |
list($entity_type, $bundle_type, $field_name) = explode(':', $child); |
... | ... | |
48 | 48 |
} |
49 | 49 |
|
50 | 50 |
function _ctools_entity_field_value_ctools_access_get_child($plugin, $parent, $entity_type, $bundle_type, $field_name, $entity = NULL, $bundle = NULL, $field = NULL) { |
51 |
|
|
52 | 51 |
// check that the entity, bundle and field arrays have a value. |
53 | 52 |
// If not, load theme using machine names. |
54 | 53 |
if (empty($entity)) { |
... | ... | |
86 | 85 |
$instance = $instances[$field_name]; |
87 | 86 |
$field = field_info_field_by_id($instance['field_id']); |
88 | 87 |
foreach ($field['columns'] as $column => $attributes) { |
89 |
$columns[] = _field_sql_storage_columnname($field_name, $column); |
|
88 |
$columns[$column] = _field_sql_storage_columnname($field_name, $column);
|
|
90 | 89 |
} |
91 | 90 |
ctools_include('fields'); |
92 | 91 |
$entity = (object)array( |
93 | 92 |
$entity_info['entity keys']['bundle'] => $bundle_type, |
94 | 93 |
); |
94 |
|
|
95 |
foreach ($columns as $column => $sql_column) { |
|
96 |
if (isset($conf[$sql_column])) { |
|
97 |
if (is_array($conf[$sql_column])) { |
|
98 |
foreach ($conf[$sql_column] as $delta => $conf_value) { |
|
99 |
if (is_numeric($delta)) { |
|
100 |
if (is_array($conf_value)) { |
|
101 |
$entity->{$field_name}[LANGUAGE_NONE][$delta][$column] = $conf_value[$column]; |
|
102 |
} |
|
103 |
else { |
|
104 |
$entity->{$field_name}[LANGUAGE_NONE][$delta][$column] = $conf_value; |
|
105 |
} |
|
106 |
} |
|
107 |
} |
|
108 |
} |
|
109 |
else { |
|
110 |
$entity->{$field_name}[LANGUAGE_NONE][0][$column] = $conf[$sql_column]; |
|
111 |
} |
|
112 |
} |
|
113 |
} |
|
114 |
|
|
115 |
$form['#parents'] = array('settings'); |
|
95 | 116 |
$langcode = field_valid_language(NULL); |
96 | 117 |
$form['settings'] += (array) ctools_field_invoke_field($instance, 'form', $entity_type, $entity, $form, $form_state, array('default' => TRUE, 'language' => $langcode)); |
97 | 118 |
// weight is really not important once this is populated and will only interfere with the form layout. |
... | ... | |
99 | 120 |
unset($form['settings'][$element]['#weight']); |
100 | 121 |
} |
101 | 122 |
|
102 |
// Need more logic here to handle compound fields. |
|
103 |
foreach ($columns as $column) { |
|
104 |
if (isset($conf[$column]) && is_array($conf[$column])) { |
|
105 |
foreach ($conf[$column] as $delta => $conf_value) { |
|
106 |
if (is_numeric($delta) && is_array($conf_value)) { |
|
107 |
$form['settings'][$field_name][LANGUAGE_NONE][$delta]['value']['#default_value'] = $conf_value['value']; |
|
108 |
} |
|
109 |
} |
|
110 |
} |
|
111 |
else { |
|
112 |
$form['settings'][$field_name][LANGUAGE_NONE]['#default_value'] = $conf[$column]; |
|
113 |
} |
|
114 |
} |
|
115 |
|
|
116 | 123 |
return $form; |
117 | 124 |
} |
118 | 125 |
|
119 |
/** |
|
120 |
* Compress the entity bundles allowed to the minimum. |
|
121 |
*/ |
|
122 | 126 |
function ctools_entity_field_value_ctools_access_settings_submit($form, &$form_state) { |
123 | 127 |
$plugin = $form_state['plugin']; |
124 | 128 |
list($parent, $entity_type, $bundle_type, $field_name) = explode(':', $plugin['name']); |
... | ... | |
128 | 132 |
$instance = $instances[$field_name]; |
129 | 133 |
$field = field_info_field_by_id($instance['field_id']); |
130 | 134 |
foreach ($field['columns'] as $column => $attributes) { |
131 |
$columns[] = _field_sql_storage_columnname($field_name, $column); |
|
135 |
$columns[$column] = _field_sql_storage_columnname($field_name, $column); |
|
136 |
} |
|
137 |
$items = _ctools_entity_field_value_get_proper_form_items($field, $form_state['values']['settings'][$field_name][$langcode], array_keys($columns)); |
|
138 |
foreach ($columns as $column => $sql_column) { |
|
139 |
$column_items = _ctools_entity_field_value_filter_items_by_column($items, $column); |
|
140 |
$form_state['values']['settings'][$sql_column] = $column_items; |
|
132 | 141 |
} |
142 |
$form_state['values']['settings'][$field_name][$langcode] = $items; |
|
143 |
} |
|
144 |
|
|
145 |
function _ctools_entity_field_value_get_proper_form_items($field, $form_items, $columns) { |
|
146 |
$items = array(); |
|
147 |
|
|
148 |
if (!is_array($form_items)) { // Single value item. |
|
149 |
foreach ($columns as $column) { |
|
150 |
$items[0][$column] = $form_items; |
|
151 |
} |
|
152 |
return $items; |
|
153 |
} |
|
154 |
|
|
155 |
foreach ($form_items as $delta => $value) { |
|
156 |
$item = array(); |
|
157 |
if (is_numeric($delta)) { // Array of field values. |
Formats disponibles : Unified diff
Weekly update of contrib modules