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
dependencies[] = ctools
package = Chaos tool suite
; Information added by Drupal.org packaging script on 2014-02-12
version = "7.x-1.4"
; Information added by Drupal.org packaging script on 2014-11-19
version = "7.x-1.5"
core = "7.x"
project = "ctools"
datestamp = "1392220730"
datestamp = "1416423525"
......@@ -6,9 +6,9 @@ files[] = includes/context.inc
files[] = includes/math-expr.inc
files[] = includes/stylizer.inc
; Information added by Drupal.org packaging script on 2014-02-12
version = "7.x-1.4"
; Information added by Drupal.org packaging script on 2014-11-19
version = "7.x-1.5"
core = "7.x"
project = "ctools"
datestamp = "1392220730"
datestamp = "1416423525"
......@@ -298,7 +298,7 @@ function ctools_break_phrase($str) {
/**
* Set a token/value pair to be replaced later in the request, specifically in
* ctools_preprocess_page().
* ctools_page_token_processing().
*
* @param $token
* The token to be replaced later, during page rendering. This should
......@@ -654,15 +654,15 @@ function ctools_page_token_processing($children, $elements) {
list($type, $argument) = $key;
switch ($type) {
case 'variable':
$tokens[$token] = isset($variables[$argument]) ? $variables[$argument] : '';
$tokens[$token] = isset($elements[$argument]) ? $elements[$argument] : '';
break;
case 'callback':
if (is_string($argument) && function_exists($argument)) {
$tokens[$token] = $argument($variables);
$tokens[$token] = $argument($elements);
}
if (is_array($argument) && function_exists($argument[0])) {
$function = array_shift($argument);
$argument = array_merge(array(&$variables), $argument);
$argument = array_merge(array(&$elements), $argument);
$tokens[$token] = call_user_func_array($function, $argument);
}
break;
......
......@@ -4,9 +4,9 @@ core = 7.x
package = Chaos tool suite
dependencies[] = ctools
; Information added by Drupal.org packaging script on 2014-02-12
version = "7.x-1.4"
; Information added by Drupal.org packaging script on 2014-11-19
version = "7.x-1.5"
core = "7.x"
project = "ctools"
datestamp = "1392220730"
datestamp = "1416423525"
......@@ -4,9 +4,9 @@ package = Chaos tool suite
dependencies[] = ctools
core = 7.x
; Information added by Drupal.org packaging script on 2014-02-12
version = "7.x-1.4"
; Information added by Drupal.org packaging script on 2014-11-19
version = "7.x-1.5"
core = "7.x"
project = "ctools"
datestamp = "1392220730"
datestamp = "1416423525"
......@@ -4,9 +4,9 @@ core = 7.x
package = Chaos tool suite
dependencies[] = ctools
; Information added by Drupal.org packaging script on 2014-02-12
version = "7.x-1.4"
; Information added by Drupal.org packaging script on 2014-11-19
version = "7.x-1.5"
core = "7.x"
project = "ctools"
datestamp = "1392220730"
datestamp = "1416423525"
......@@ -7,9 +7,9 @@ dependencies[] = page_manager
dependencies[] = advanced_help
core = 7.x
; Information added by Drupal.org packaging script on 2014-02-12
version = "7.x-1.4"
; Information added by Drupal.org packaging script on 2014-11-19
version = "7.x-1.5"
core = "7.x"
project = "ctools"
datestamp = "1392220730"
datestamp = "1416423525"
......@@ -24,6 +24,17 @@ The following information can be specified for each plugin type:
<dt>cache table</dt>
<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>
<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>
<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>
......
......@@ -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)));
}
/**
* 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.
*
......
......@@ -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
* form wishes to render, it automatically does that, otherwise it returns
* 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']
* is set, this will use ctools_modal_form_render so it will be
* a $command object suitable for ajax_render already.
......@@ -199,6 +206,13 @@ function ctools_modal_text_button($text, $dest, $alt, $class = '') {
* form will never be redirected.
*/
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.
$form_state += array(
're_render' => FALSE,
......
......@@ -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 @@
$('input[type=submit], button', this).click(function(event) {
Drupal.ajax[base].element = 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
// in jquery 1.4 this won't trigger a submit.
if (event.bubbles == undefined) {
......
......@@ -4,9 +4,9 @@ core = 7.x
dependencies[] = ctools
package = Chaos tool suite
; Information added by Drupal.org packaging script on 2014-02-12
version = "7.x-1.4"
; Information added by Drupal.org packaging script on 2014-11-19
version = "7.x-1.5"
core = "7.x"
project = "ctools"
datestamp = "1392220730"
datestamp = "1416423525"
......@@ -443,7 +443,7 @@ function page_manager_page_form_basic($form, &$form_state) {
'#type' => 'checkbox',
'#default_value' => !empty($page->make_frontpage),
'#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(
'#type' => 'checkbox',
......
......@@ -14,6 +14,8 @@ $plugin = array(
'title' => t('String'),
'description' => t('A context that is just a string.'),
'context' => 'ctools_context_create_string',
'edit form' => 'ctools_context_string_settings_form',
'defaults' => '',
'keyword' => 'string',
'no ui' => FALSE,
'context name' => 'string',
......@@ -44,7 +46,8 @@ function ctools_context_create_string($empty, $data = NULL, $conf = 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);
return $context;
}
......@@ -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) {
* Return a new context based on an existing context.
*/
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;
$plugin = $conf['name'];
list($plugin, $plugin_name) = explode(':', $plugin);
......@@ -176,8 +181,11 @@ function ctools_entity_from_field_context($context, $conf) {
$plugin_info = ctools_get_relationship($conf['name']);
$to_entity_id = $items[$delta][$plugin_info['source key']];
$loaded_to_entity = array_shift(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 = entity_load($to_entity, array($to_entity_id));
$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);
}
else {
......
......@@ -5,9 +5,9 @@ package = Chaos tool suite
dependencies[] = ctools
dependencies[] = color
; Information added by Drupal.org packaging script on 2014-02-12
version = "7.x-1.4"
; Information added by Drupal.org packaging script on 2014-11-19
version = "7.x-1.5"
core = "7.x"
project = "ctools"
datestamp = "1392220730"
datestamp = "1416423525"
......@@ -3,9 +3,9 @@ description = Controls access to context based upon term depth
core = 7.x
dependencies[] = ctools
package = Chaos tool suite
; Information added by Drupal.org packaging script on 2014-02-12
version = "7.x-1.4"
; Information added by Drupal.org packaging script on 2014-11-19
version = "7.x-1.5"
core = "7.x"
project = "ctools"
datestamp = "1392220730"
datestamp = "1416423525"
......@@ -7,9 +7,9 @@ hidden = TRUE
files[] = ctools_export.test
; Information added by Drupal.org packaging script on 2014-02-12
version = "7.x-1.4"
; Information added by Drupal.org packaging script on 2014-11-19
version = "7.x-1.5"
core = "7.x"
project = "ctools"
datestamp = "1392220730"
datestamp = "1416423525"
......@@ -11,9 +11,9 @@ files[] = math_expression.test
files[] = math_expression_stack.test
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-02-12
version = "7.x-1.4"
; Information added by Drupal.org packaging script on 2014-11-19
version = "7.x-1.5"
core = "7.x"
project = "ctools"
datestamp = "1392220730"
datestamp = "1416423525"
......@@ -145,12 +145,12 @@ function views_content_views_content_type_render($subtype, $conf, $panel_args, $
}
if (!empty($contexts[$cid])) {
$arg = ctools_context_convert_context($contexts[$cid], $converter, array('sanitize' => FALSE));
array_splice($args, $count, 0, array($arg));
}
else {
// Make sure we put an argument in even if it was not there.
$arg = NULL;
}
array_splice($args, $count, 0, array($arg));
}
}
......
......@@ -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_style_ctools_context.inc
; Information added by Drupal.org packaging script on 2014-02-12
version = "7.x-1.4"
; Information added by Drupal.org packaging script on 2014-11-19
version = "7.x-1.5"
core = "7.x"
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