Commit ce8917ae authored by Riccardo Padovani's avatar Riccardo Padovani

Updated module ctools to 7.x-1.5

parent 0d0712f1
File mode changed from 100755 to 100644
...@@ -4,9 +4,9 @@ core = 7.x ...@@ -4,9 +4,9 @@ core = 7.x
dependencies[] = ctools dependencies[] = ctools
package = Chaos tool suite package = Chaos tool suite
; Information added by Drupal.org packaging script on 2014-02-12 ; Information added by Drupal.org packaging script on 2014-11-19
version = "7.x-1.4" version = "7.x-1.5"
core = "7.x" core = "7.x"
project = "ctools" project = "ctools"
datestamp = "1392220730" datestamp = "1416423525"
...@@ -6,9 +6,9 @@ files[] = includes/context.inc ...@@ -6,9 +6,9 @@ files[] = includes/context.inc
files[] = includes/math-expr.inc files[] = includes/math-expr.inc
files[] = includes/stylizer.inc files[] = includes/stylizer.inc
; Information added by Drupal.org packaging script on 2014-02-12 ; Information added by Drupal.org packaging script on 2014-11-19
version = "7.x-1.4" version = "7.x-1.5"
core = "7.x" core = "7.x"
project = "ctools" project = "ctools"
datestamp = "1392220730" datestamp = "1416423525"
...@@ -298,7 +298,7 @@ function ctools_break_phrase($str) { ...@@ -298,7 +298,7 @@ function ctools_break_phrase($str) {
/** /**
* Set a token/value pair to be replaced later in the request, specifically in * Set a token/value pair to be replaced later in the request, specifically in
* ctools_preprocess_page(). * ctools_page_token_processing().
* *
* @param $token * @param $token
* The token to be replaced later, during page rendering. This should * The token to be replaced later, during page rendering. This should
...@@ -654,15 +654,15 @@ function ctools_page_token_processing($children, $elements) { ...@@ -654,15 +654,15 @@ function ctools_page_token_processing($children, $elements) {
list($type, $argument) = $key; list($type, $argument) = $key;
switch ($type) { switch ($type) {
case 'variable': case 'variable':
$tokens[$token] = isset($variables[$argument]) ? $variables[$argument] : ''; $tokens[$token] = isset($elements[$argument]) ? $elements[$argument] : '';
break; break;
case 'callback': case 'callback':
if (is_string($argument) && function_exists($argument)) { if (is_string($argument) && function_exists($argument)) {
$tokens[$token] = $argument($variables); $tokens[$token] = $argument($elements);
} }
if (is_array($argument) && function_exists($argument[0])) { if (is_array($argument) && function_exists($argument[0])) {
$function = array_shift($argument); $function = array_shift($argument);
$argument = array_merge(array(&$variables), $argument); $argument = array_merge(array(&$elements), $argument);
$tokens[$token] = call_user_func_array($function, $argument); $tokens[$token] = call_user_func_array($function, $argument);
} }
break; break;
......
...@@ -4,9 +4,9 @@ core = 7.x ...@@ -4,9 +4,9 @@ core = 7.x
package = Chaos tool suite package = Chaos tool suite
dependencies[] = ctools dependencies[] = ctools
; Information added by Drupal.org packaging script on 2014-02-12 ; Information added by Drupal.org packaging script on 2014-11-19
version = "7.x-1.4" version = "7.x-1.5"
core = "7.x" core = "7.x"
project = "ctools" project = "ctools"
datestamp = "1392220730" datestamp = "1416423525"
...@@ -4,9 +4,9 @@ package = Chaos tool suite ...@@ -4,9 +4,9 @@ package = Chaos tool suite
dependencies[] = ctools dependencies[] = ctools
core = 7.x core = 7.x
; Information added by Drupal.org packaging script on 2014-02-12 ; Information added by Drupal.org packaging script on 2014-11-19
version = "7.x-1.4" version = "7.x-1.5"
core = "7.x" core = "7.x"
project = "ctools" project = "ctools"
datestamp = "1392220730" datestamp = "1416423525"
...@@ -4,9 +4,9 @@ core = 7.x ...@@ -4,9 +4,9 @@ core = 7.x
package = Chaos tool suite package = Chaos tool suite
dependencies[] = ctools dependencies[] = ctools
; Information added by Drupal.org packaging script on 2014-02-12 ; Information added by Drupal.org packaging script on 2014-11-19
version = "7.x-1.4" version = "7.x-1.5"
core = "7.x" core = "7.x"
project = "ctools" project = "ctools"
datestamp = "1392220730" datestamp = "1416423525"
...@@ -7,9 +7,9 @@ dependencies[] = page_manager ...@@ -7,9 +7,9 @@ dependencies[] = page_manager
dependencies[] = advanced_help dependencies[] = advanced_help
core = 7.x core = 7.x
; Information added by Drupal.org packaging script on 2014-02-12 ; Information added by Drupal.org packaging script on 2014-11-19
version = "7.x-1.4" version = "7.x-1.5"
core = "7.x" core = "7.x"
project = "ctools" project = "ctools"
datestamp = "1392220730" datestamp = "1416423525"
...@@ -24,6 +24,17 @@ The following information can be specified for each plugin type: ...@@ -24,6 +24,17 @@ The following information can be specified for each plugin type:
<dt>cache table</dt> <dt>cache table</dt>
<dd><em>Defaults to:</em> <strong>'cache'</strong></dd> <dd><em>Defaults to:</em> <strong>'cache'</strong></dd>
<dd>If 'cache' is TRUE, then this value specifies the cache table where the cached plugin information will be stored.</dd> <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>
<dl>
<dt>- a file name:</dt>
<dd>the file which holds the class with the name structure as: <em>[filename].[class].php</em></dd>
<dd>in this case the class name can be different than the <em>class identifier</em></dd>
<dt>- the class name:</dt>
<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>
<dt>defaults</dt> <dt>defaults</dt>
<dd><em>Defaults to:</em> <strong>array()</strong></dd> <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> <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>
......
...@@ -49,6 +49,34 @@ function ctools_ajax_text_button($text, $dest, $alt, $class = '', $type = 'use-a ...@@ -49,6 +49,34 @@ function ctools_ajax_text_button($text, $dest, $alt, $class = '', $type = 'use-a
return l($text, $dest, array('html' => TRUE, 'attributes' => array('class' => array($type, $class), 'title' => $alt))); return l($text, $dest, array('html' => TRUE, 'attributes' => array('class' => array($type, $class), 'title' => $alt)));
} }
/**
* Render an icon and related text as a link. This will automatically apply an AJAX class
* to the link and add the appropriate javascript to make this happen.
*
* Note: 'html' => true so be sure any text is vetted! Chances are these kinds of buttons will
* not use user input so this is a very minor concern.
*
* @param $text
* The text that will be displayed as the link.
* @param $image
* The icon image to include in the link.
* @param $dest
* The destination of the link.
* @param $alt
* The title text of the link.
* @param $class
* Any class to apply to the link. @todo this should be a options array.
* @param $type
* A type to use, in case a different behavior should be attached. Defaults
* to ctools-use-ajax.
*/
function ctools_ajax_icon_text_button($text, $image, $dest, $alt, $class = '', $type = 'use-ajax') {
drupal_add_library('system', 'drupal.ajax');
$rendered_image = theme('image', array('path' => $image));
$link_content = $rendered_image . "<span>" . $text . "</span>";
return l($link_content, $dest, array('html' => TRUE, 'attributes' => array('class' => array($type, $class), 'title' => $alt)));
}
/** /**
* Set a single property to a value, on all matched elements. * Set a single property to a value, on all matched elements.
* *
......
...@@ -188,8 +188,15 @@ function ctools_modal_text_button($text, $dest, $alt, $class = '') { ...@@ -188,8 +188,15 @@ function ctools_modal_text_button($text, $dest, $alt, $class = '') {
* Wrap a form so that we can use it properly with AJAX. Essentially if the * 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 * form wishes to render, it automatically does that, otherwise it returns
* so we can see submission results. * so we can see submission results.
* @param array $form
* An associative array containing the structure of the form.
* @param array $form_state
* An associative array containing the current state of the form.
* If the 'reset_html_ids' key is set to TRUE, it will prevent HTML IDs in
* forms from being incremented.
* *
* @return * @return mixed
* The output of the form, if it was rendered. If $form_state['ajax'] * The output of the form, if it was rendered. If $form_state['ajax']
* is set, this will use ctools_modal_form_render so it will be * is set, this will use ctools_modal_form_render so it will be
* a $command object suitable for ajax_render already. * a $command object suitable for ajax_render already.
...@@ -199,6 +206,13 @@ function ctools_modal_text_button($text, $dest, $alt, $class = '') { ...@@ -199,6 +206,13 @@ function ctools_modal_text_button($text, $dest, $alt, $class = '') {
* form will never be redirected. * form will never be redirected.
*/ */
function ctools_modal_form_wrapper($form_id, &$form_state) { function ctools_modal_form_wrapper($form_id, &$form_state) {
// Since this will run again on form rebuild while still in the modal, prevent
// form IDs from being incremented.
// @todo https://drupal.org/node/1305882
if (!empty($form_state['reset_html_ids']) && !empty($_POST['ajax_html_ids'])) {
unset($_POST['ajax_html_ids']);
}
// This won't override settings already in. // This won't override settings already in.
$form_state += array( $form_state += array(
're_render' => FALSE, 're_render' => FALSE,
......
...@@ -29,16 +29,3 @@ function ctools_passthrough($module, $type, &$items) { ...@@ -29,16 +29,3 @@ function ctools_passthrough($module, $type, &$items) {
} }
} }
} }
/**
* Implementation of hook_theme_registry_alter()
*/
function ctools_theme_registry_alter(&$registry) {
// Move this one last last last so it can catch changes made by modules and themes.
$key = array_search('ctools_preprocess_page', $registry['page']['preprocess functions']);
if ($key) {
unset($registry['page']['preprocess functions'][$key]);
}
$registry['page']['preprocess functions'][] = 'ctools_preprocess_page';
}
...@@ -258,6 +258,10 @@ ...@@ -258,6 +258,10 @@
$('input[type=submit], button', this).click(function(event) { $('input[type=submit], button', this).click(function(event) {
Drupal.ajax[base].element = this; Drupal.ajax[base].element = this;
this.form.clk = this; this.form.clk = this;
// Stop autocomplete from submitting.
if (Drupal.autocompleteSubmit && !Drupal.autocompleteSubmit()) {
return false;
}
// An empty event means we were triggered via .click() and // An empty event means we were triggered via .click() and
// in jquery 1.4 this won't trigger a submit. // in jquery 1.4 this won't trigger a submit.
if (event.bubbles == undefined) { if (event.bubbles == undefined) {
......
...@@ -4,9 +4,9 @@ core = 7.x ...@@ -4,9 +4,9 @@ core = 7.x
dependencies[] = ctools dependencies[] = ctools
package = Chaos tool suite package = Chaos tool suite
; Information added by Drupal.org packaging script on 2014-02-12 ; Information added by Drupal.org packaging script on 2014-11-19
version = "7.x-1.4" version = "7.x-1.5"
core = "7.x" core = "7.x"
project = "ctools" project = "ctools"
datestamp = "1392220730" datestamp = "1416423525"
...@@ -443,7 +443,7 @@ function page_manager_page_form_basic($form, &$form_state) { ...@@ -443,7 +443,7 @@ function page_manager_page_form_basic($form, &$form_state) {
'#type' => 'checkbox', '#type' => 'checkbox',
'#default_value' => !empty($page->make_frontpage), '#default_value' => !empty($page->make_frontpage),
'#title' => t('Make this your site home page.'), '#title' => t('Make this your site home page.'),
'#description' => t('To set this panel as your home page you must create a unique path name with no % placeholders in the path. The site home page is currently set to %homepage on the !siteinfo configuration form.', array('!siteinfo' => l(t('Site Information'), 'admin/settings/site-information'), '%homepage' => '/' . $frontpage)), '#description' => t('To set this panel as your home page you must create a unique path name with no % placeholders in the path. The site home page is currently set to %homepage on the !siteinfo configuration form.', array('!siteinfo' => l(t('Site Information'), 'admin/config/system/site-information'), '%homepage' => '/' . $frontpage)),
); );
$form['admin_paths'] = array( $form['admin_paths'] = array(
'#type' => 'checkbox', '#type' => 'checkbox',
......
...@@ -14,6 +14,8 @@ $plugin = array( ...@@ -14,6 +14,8 @@ $plugin = array(
'title' => t('String'), 'title' => t('String'),
'description' => t('A context that is just a string.'), 'description' => t('A context that is just a string.'),
'context' => 'ctools_context_create_string', 'context' => 'ctools_context_create_string',
'edit form' => 'ctools_context_string_settings_form',
'defaults' => '',
'keyword' => 'string', 'keyword' => 'string',
'no ui' => FALSE, 'no ui' => FALSE,
'context name' => 'string', 'context name' => 'string',
...@@ -44,7 +46,8 @@ function ctools_context_create_string($empty, $data = NULL, $conf = FALSE) { ...@@ -44,7 +46,8 @@ function ctools_context_create_string($empty, $data = NULL, $conf = FALSE) {
} }
if ($data !== FALSE ) { if ($data !== FALSE ) {
$context->data = $data; // Support the array storage from the settings form but also handle direct input from arguments.
$context->data = is_array($data) ? $data['string'] : $data;
$context->title = ($conf) ? check_plain($data['identifier']) : check_plain($data); $context->title = ($conf) ? check_plain($data['identifier']) : check_plain($data);
return $context; return $context;
} }
...@@ -62,3 +65,23 @@ function ctools_context_string_convert($context, $type) { ...@@ -62,3 +65,23 @@ function ctools_context_string_convert($context, $type) {
} }
} }
/**
* String settings form.
*/
function ctools_context_string_settings_form($form, &$form_state) {
$conf = &$form_state['conf'];
$form['string'] = array(
'#title' => t('Enter the string'),
'#type' => 'textfield',
'#maxlength' => 512,
'#weight' => -10,
'#default_value' => $conf['string'],
);
return $form;
}
function ctools_context_string_settings_form_submit($form, &$form_state) {
$form_state['conf']['string'] = $form_state['values']['string'];
}
...@@ -154,6 +154,11 @@ function ctools_entity_from_field_get_children($parent_plugin, $parent) { ...@@ -154,6 +154,11 @@ function ctools_entity_from_field_get_children($parent_plugin, $parent) {
* Return a new context based on an existing context. * Return a new context based on an existing context.
*/ */
function ctools_entity_from_field_context($context, $conf) { function ctools_entity_from_field_context($context, $conf) {
// Perform access check on current logged in user.
global $user;
// Clone user object so account can be passed by value to access callback.
$account = clone $user;
$delta = !empty($conf['delta']) ? intval($conf['delta']) : 0; $delta = !empty($conf['delta']) ? intval($conf['delta']) : 0;
$plugin = $conf['name']; $plugin = $conf['name'];
list($plugin, $plugin_name) = explode(':', $plugin); list($plugin, $plugin_name) = explode(':', $plugin);
...@@ -176,8 +181,11 @@ function ctools_entity_from_field_context($context, $conf) { ...@@ -176,8 +181,11 @@ function ctools_entity_from_field_context($context, $conf) {
$plugin_info = ctools_get_relationship($conf['name']); $plugin_info = ctools_get_relationship($conf['name']);
$to_entity_id = $items[$delta][$plugin_info['source key']]; $to_entity_id = $items[$delta][$plugin_info['source key']];
$loaded_to_entity = array_shift(entity_load($to_entity, array($to_entity_id))); $loaded_to_entity = entity_load($to_entity, array($to_entity_id));
if(function_exists($to_entity_info['access callback']) && !call_user_func($to_entity_info['access callback'], 'view', $loaded_to_entity)) { $loaded_to_entity = array_shift($loaded_to_entity);
// Pass current user account and entity type to access callback.
if (function_exists($to_entity_info['access callback']) && !call_user_func($to_entity_info['access callback'], 'view', $loaded_to_entity, $account, $to_entity)) {
return ctools_context_create_empty('entity:' . $to_entity, NULL); return ctools_context_create_empty('entity:' . $to_entity, NULL);
} }
else { else {
......
...@@ -5,9 +5,9 @@ package = Chaos tool suite ...@@ -5,9 +5,9 @@ package = Chaos tool suite
dependencies[] = ctools dependencies[] = ctools
dependencies[] = color dependencies[] = color
; Information added by Drupal.org packaging script on 2014-02-12 ; Information added by Drupal.org packaging script on 2014-11-19
version = "7.x-1.4" version = "7.x-1.5"
core = "7.x" core = "7.x"
project = "ctools" project = "ctools"
datestamp = "1392220730" datestamp = "1416423525"
...@@ -3,9 +3,9 @@ description = Controls access to context based upon term depth ...@@ -3,9 +3,9 @@ description = Controls access to context based upon term depth
core = 7.x core = 7.x
dependencies[] = ctools dependencies[] = ctools
package = Chaos tool suite package = Chaos tool suite
; Information added by Drupal.org packaging script on 2014-02-12 ; Information added by Drupal.org packaging script on 2014-11-19
version = "7.x-1.4" version = "7.x-1.5"
core = "7.x" core = "7.x"
project = "ctools" project = "ctools"
datestamp = "1392220730" datestamp = "1416423525"
...@@ -7,9 +7,9 @@ hidden = TRUE ...@@ -7,9 +7,9 @@ hidden = TRUE
files[] = ctools_export.test files[] = ctools_export.test
; Information added by Drupal.org packaging script on 2014-02-12 ; Information added by Drupal.org packaging script on 2014-11-19
version = "7.x-1.4" version = "7.x-1.5"
core = "7.x" core = "7.x"
project = "ctools" project = "ctools"
datestamp = "1392220730" datestamp = "1416423525"
...@@ -11,9 +11,9 @@ files[] = math_expression.test ...@@ -11,9 +11,9 @@ files[] = math_expression.test
files[] = math_expression_stack.test files[] = math_expression_stack.test
hidden = TRUE hidden = TRUE
; Information added by Drupal.org packaging script on 2014-02-12 ; Information added by Drupal.org packaging script on 2014-11-19
version = "7.x-1.4" version = "7.x-1.5"
core = "7.x" core = "7.x"
project = "ctools" project = "ctools"
datestamp = "1392220730" datestamp = "1416423525"
...@@ -145,12 +145,12 @@ function views_content_views_content_type_render($subtype, $conf, $panel_args, $ ...@@ -145,12 +145,12 @@ function views_content_views_content_type_render($subtype, $conf, $panel_args, $
} }
if (!empty($contexts[$cid])) { if (!empty($contexts[$cid])) {
$arg = ctools_context_convert_context($contexts[$cid], $converter, array('sanitize' => FALSE)); $arg = ctools_context_convert_context($contexts[$cid], $converter, array('sanitize' => FALSE));
array_splice($args, $count, 0, array($arg));
} }
else { else {
// Make sure we put an argument in even if it was not there. // Make sure we put an argument in even if it was not there.
$arg = NULL; $arg = NULL;
} }
array_splice($args, $count, 0, array($arg));
} }
} }
......
...@@ -9,9 +9,9 @@ files[] = plugins/views/views_content_plugin_display_ctools_context.inc ...@@ -9,9 +9,9 @@ files[] = plugins/views/views_content_plugin_display_ctools_context.inc
files[] = plugins/views/views_content_plugin_display_panel_pane.inc files[] = plugins/views/views_content_plugin_display_panel_pane.inc
files[] = plugins/views/views_content_plugin_style_ctools_context.inc files[] = plugins/views/views_content_plugin_style_ctools_context.inc
; Information added by Drupal.org packaging script on 2014-02-12 ; Information added by Drupal.org packaging script on 2014-11-19
version = "7.x-1.4" version = "7.x-1.5"
core = "7.x" core = "7.x"
project = "ctools" project = "ctools"
datestamp = "1392220730" datestamp = "1416423525"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment