updated ctools, panels, date, diff

This commit is contained in:
Bachir Soussi Chiadmi
2017-05-24 19:22:50 +02:00
parent 542ac42fca
commit 9acef9d37e
189 changed files with 2928 additions and 1797 deletions

View File

@@ -6,9 +6,9 @@ package = Chaos tool suite
version = CTOOLS_MODULE_VERSION
; Information added by Drupal.org packaging script on 2016-10-16
version = "7.x-1.11"
; Information added by Drupal.org packaging script on 2016-11-22
version = "7.x-1.12"
core = "7.x"
project = "ctools"
datestamp = "1476581654"
datestamp = "1479787162"

View File

@@ -19,6 +19,7 @@
.ctools-button-processed .ctools-content ul {
list-style-image: none;
list-style-type: none;
margin-left: 0;
}
.ctools-button-processed li {

View File

@@ -199,7 +199,10 @@ function hook_ctools_render_alter(&$info, &$page, &$context) {
* or categories or to rename content on specific sites.
*/
function hook_ctools_content_subtype_alter($subtype, $plugin) {
$subtype['render last'] = TRUE;
// Force a particular subtype of a particular plugin to render last.
if ($plugin['module'] == 'some_plugin_module' && $plugin['name'] == 'some_plugin_name' && $subtype['subtype_id'] == 'my_subtype_id') {
$subtype['render last'] = TRUE;
}
}
/**

View File

@@ -6,11 +6,19 @@ files[] = includes/context.inc
files[] = includes/css-cache.inc
files[] = includes/math-expr.inc
files[] = includes/stylizer.inc
files[] = tests/css_cache.test
; Information added by Drupal.org packaging script on 2016-10-16
version = "7.x-1.11"
; Tests.
files[] = tests/context.test
files[] = tests/css.test
files[] = tests/css_cache.test
files[] = tests/ctools.plugins.test
files[] = tests/math_expression.test
files[] = tests/math_expression_stack.test
files[] = tests/object_cache.test
; Information added by Drupal.org packaging script on 2016-11-22
version = "7.x-1.12"
core = "7.x"
project = "ctools"
datestamp = "1476581654"
datestamp = "1479787162"

View File

@@ -5,9 +5,9 @@ package = Chaos tool suite
version = CTOOLS_MODULE_VERSION
dependencies[] = ctools
; Information added by Drupal.org packaging script on 2016-10-16
version = "7.x-1.11"
; Information added by Drupal.org packaging script on 2016-11-22
version = "7.x-1.12"
core = "7.x"
project = "ctools"
datestamp = "1476581654"
datestamp = "1479787162"

View File

@@ -5,9 +5,9 @@ version = CTOOLS_MODULE_VERSION
dependencies[] = ctools
core = 7.x
; Information added by Drupal.org packaging script on 2016-10-16
version = "7.x-1.11"
; Information added by Drupal.org packaging script on 2016-11-22
version = "7.x-1.12"
core = "7.x"
project = "ctools"
datestamp = "1476581654"
datestamp = "1479787162"

View File

@@ -5,9 +5,9 @@ package = Chaos tool suite
version = CTOOLS_MODULE_VERSION
dependencies[] = ctools
; Information added by Drupal.org packaging script on 2016-10-16
version = "7.x-1.11"
; Information added by Drupal.org packaging script on 2016-11-22
version = "7.x-1.12"
core = "7.x"
project = "ctools"
datestamp = "1476581654"
datestamp = "1479787162"

View File

@@ -8,9 +8,9 @@ dependencies[] = page_manager
dependencies[] = advanced_help
core = 7.x
; Information added by Drupal.org packaging script on 2016-10-16
version = "7.x-1.11"
; Information added by Drupal.org packaging script on 2016-11-22
version = "7.x-1.12"
core = "7.x"
project = "ctools"
datestamp = "1476581654"
datestamp = "1479787162"

View File

@@ -64,7 +64,7 @@ function ctools_drush_command() {
'machine names' => 'Space separated list of exportables you want to view.',
),
'options' => array(
'indent' => 'The string to use for indentation when dispalying the exportable export code. Defaults to \'\'.',
'indent' => 'The string to use for indentation when displaying the exportable export code. Defaults to \'\'.',
'no-colour' => 'Remove any colour formatting from export string output. Ideal if you are sending the output of this command to a file.',
'module' => $module_text,
'all' => $all_text,

View File

@@ -155,6 +155,11 @@ function ctools_content_get_subtypes($type) {
// Walk through the subtypes and ensure minimal settings are
// retained.
foreach ($subtypes as $id => $subtype) {
// Ensure that the 'subtype_id' value exists.
if (!isset($subtype['subtype_id'])) {
$subtype['subtype_id'] = $id;
}
// Use exact name since this is a modify by reference.
ctools_content_prepare_subtype($subtypes[$id], $plugin);
}
@@ -217,6 +222,7 @@ function ctools_content_prepare_subtype(&$subtype, $plugin) {
}
}
// Trigger hook_ctools_content_subtype_alter().
drupal_alter('ctools_content_subtype', $subtype, $plugin);
}
@@ -241,8 +247,8 @@ function ctools_content_prepare_subtype(&$subtype, $plugin) {
* Any incoming content, if this display is a wrapper.
*
* @return
* The content as rendered by the plugin. This content should be an array
* with the following possible keys:
* The content as rendered by the plugin, or NULL.
* This content should be an object with the following possible properties:
* - title: The safe to render title of the content.
* - title_heading: The title heading.
* - content: The safe to render HTML content.

View File

@@ -367,7 +367,6 @@ function ctools_access_ajax_edit($fragment = NULL, $id = NULL) {
'contexts' => $contexts,
'title' => t('Edit criteria'),
'ajax' => TRUE,
'ajax' => TRUE,
'modal' => TRUE,
'modal return' => TRUE,
);

View File

@@ -676,14 +676,19 @@ function ctools_context_keyword_substitute($string, $keywords, $contexts, $conve
}
}
if (empty($context_keywords[$context]) || !empty($context_keywords[$context]->empty)) {
$keywords['%' . $keyword] = '';
}
else if (!empty($converter)) {
$keywords['%' . $keyword] = ctools_context_convert_context($context_keywords[$context], $converter, $converter_options);
if (!isset($context_keywords[$context])) {
$keywords['%' . $keyword] = '%' . $keyword;
}
else {
$keywords['%' . $keyword] = $context_keywords[$keyword]->title;
if (empty($context_keywords[$context]) || !empty($context_keywords[$context]->empty)) {
$keywords['%' . $keyword] = '';
}
else if (!empty($converter)) {
$keywords['%' . $keyword] = ctools_context_convert_context($context_keywords[$context], $converter, $converter_options);
}
else {
$keywords['%' . $keyword] = $context_keywords[$keyword]->title;
}
}
}
}

View File

@@ -200,18 +200,18 @@ function ctools_plugin_api_get_hook($owner, $api) {
/**
* Fetch a group of plugins by name.
*
* @param $module
* The name of the module that utilizes this plugin system. It will be
* used to call hook_ctools_plugin_$plugin() to get more data about the plugin.
* @param $type
* @param string $module
* The name of the module that utilizes this plugin system. It will be used to
* get more data about the plugin as defined on hook_ctools_plugin_type().
* @param string $type
* The type identifier of the plugin.
* @param $id
* @param string $id
* If specified, return only information about plugin with this identifier.
* The system will do its utmost to load only plugins with this id.
*
* @return
* An array of information arrays about the plugins received. The contents
* of the array are specific to the plugin.
* @return array
* An array of information arrays about the plugins received. The contents of
* the array are specific to the plugin.
*/
function ctools_get_plugins($module, $type, $id = NULL) {
// Store local caches of plugins and plugin info so we don't have to do full
@@ -224,10 +224,14 @@ function ctools_get_plugins($module, $type, $id = NULL) {
$info = ctools_plugin_get_plugin_type_info();
// Bail out noisily if an invalid module/type combination is requested.
if (!isset($info[$module][$type])) {
watchdog('ctools', 'Invalid plugin module/type combination requested: module @module and type @type', array('@module' => $module, '@type' => $type), WATCHDOG_ERROR);
return array();
// If we don't find the plugin we attempt a cache rebuild before bailing out
$info = ctools_plugin_get_plugin_type_info(TRUE);
// Bail out noisily if an invalid module/type combination is requested.
if (!isset($info[$module][$type])) {
watchdog('ctools', 'Invalid plugin module/type combination requested: module @module and type @type', array('@module' => $module, '@type' => $type), WATCHDOG_ERROR);
return array();
}
}
// Make sure our plugins array is populated.
@@ -235,8 +239,8 @@ function ctools_get_plugins($module, $type, $id = NULL) {
$plugins[$module][$type] = array();
}
// Attempt to shortcut this whole piece of code if we already have
// the requested plugin:
// Attempt to shortcut this whole piece of code if we already have the
// requested plugin:
if ($id && array_key_exists($id, $plugins[$module][$type])) {
return $plugins[$module][$type][$id];
}
@@ -271,8 +275,8 @@ function ctools_get_plugins($module, $type, $id = NULL) {
$plugins[$module][$type] = ctools_plugin_load_hooks($info[$module][$type]);
}
// Then see if we should load all files. We only do this if we
// want a list of all plugins or there was a cache miss.
// Then see if we should load all files. We only do this if we want a list of
// all plugins or there was a cache miss.
if (empty($setup[$module][$type]) && ($build_cache || !$id)) {
$setup[$module][$type] = TRUE;
$plugins[$module][$type] = array_merge($plugins[$module][$type], ctools_plugin_load_includes($info[$module][$type]));
@@ -296,8 +300,8 @@ function ctools_get_plugins($module, $type, $id = NULL) {
}
// If we were told earlier that this is cacheable and the cache was
// empty, give something back.
// If we were told earlier that this is cacheable and the cache was empty,
// give something back.
if ($build_cache) {
cache_set("plugins:$module:$type", $plugins[$module][$type], $info[$module][$type]['cache table']);
}

View File

@@ -9,7 +9,9 @@
/**
* Pattern for detecting a valid UUID.
*/
define('UUID_PATTERN', '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}');
if (!defined('UUID_PATTERN')) {
define('UUID_PATTERN', '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}');
}
/**
* Generates a UUID using the Windows internal GUID generator.

View File

@@ -4,7 +4,7 @@ Note: this page is currently very preliminary. Please visit <a href="http://drup
This is a quick summary:
<ul>
<li>Visit administer >> site building >> pages to get to the primary page manager interface.</li>
<li>Visit administer >> structure >> pages to get to the primary page manager interface.</li>
<li>You can add custom pages for your basic landing pages, front pages, whatever you like for normal content display.</li>
<li>You can use the system pages to create finer control of how taxonomy vocabularies, nodes and user profiles are displayed.</li>
<li>When you add your first custom page, do not bother with the optional features. You will not need these until you get to more advanced tasks.</li>

View File

@@ -1688,6 +1688,12 @@ function page_manager_handler_clone_submit(&$form, &$form_state) {
page_manager_handler_add_to_page($form_state['page'], $handler, $form_state['values']['title']);
// Variant is cloned and added to the Page. Ensure the uuids are re-generated.
panels_panel_context_get_display($handler);
if (isset($handler->conf['display']) && method_exists($handler->conf['display'], 'clone_display')) {
$handler->conf['display'] = $handler->conf['display']->clone_display();
}
$plugin = page_manager_get_task_handler($handler->handler);
// It has no forms at all. Add the variant and go to its first operation.
$keys = array_keys($plugin['operations']);

View File

@@ -5,9 +5,9 @@ dependencies[] = ctools
package = Chaos tool suite
version = CTOOLS_MODULE_VERSION
; Information added by Drupal.org packaging script on 2016-10-16
version = "7.x-1.11"
; Information added by Drupal.org packaging script on 2016-11-22
version = "7.x-1.12"
core = "7.x"
project = "ctools"
datestamp = "1476581654"
datestamp = "1479787162"

View File

@@ -1462,6 +1462,15 @@ function page_manager_page_form_clone_submit(&$form, &$form_state) {
$original->path = $form_state['values']['path'];
$handlers = !empty($form_state['values']['handlers']) ? $form_state['page']->handlers : FALSE;
// Ensure the handler uuids are re-generated.
if ($handlers) {
foreach ($handlers as &$handler) {
if (isset($handler->conf['display']) && method_exists($handler->conf['display'], 'clone_display')) {
$handler->conf['display'] = $handler->conf['display']->clone_display();
}
}
}
// Export the handler, which is a fantastic way to clean database IDs out of it.
$export = page_manager_page_export($original, $handlers);
ob_start();

View File

@@ -65,6 +65,7 @@ function ctools_terms_breadcrumb($conf, $context) {
return;
}
$current = new stdClass();
$current->tid = $context->tids[0];
$breadcrumb = array();
while ($parents = taxonomy_get_parents($current->tid)) {

View File

@@ -372,9 +372,9 @@ function profile_ctools_block_info($module, $delta, &$info) {
}
function book_ctools_block_info($module, $delta, &$info) {
// Hide the book navigation block which isn't as rich as what we can
// do with context.
$info = NULL;
$info['title'] = t('Book navigation menu');
$info['icon'] = 'icon_core_block_menu.png';
$info['category'] = t('Node');
}
function blog_ctools_block_info($module, $delta, &$info) {

View File

@@ -0,0 +1,101 @@
<?php
if (module_exists('book')) {
/**
* Plugins are described by creating a $plugin array which will be used
* by the system that includes this file.
*/
$plugin = array(
'single' => TRUE,
'title' => t('Book navigation menu'),
'icon' => '../block/icon_core_block_menu.png',
'description' => t('The book menu belonging to the current book node.'),
'required context' => new ctools_context_required(t('Node'), 'node'),
'category' => t('Node'),
);
}
function ctools_node_book_menu_content_type_render($subtype, $conf, $panel_args, $context) {
$node = isset($context->data) ? clone($context->data) : NULL;
$block = new stdClass();
$block->module = 'book_menu';
if ($conf['override_title']) {
$block->title = t($conf['override_title_text']);
}
else {
$block->title = t('Book navigation menu');
}
if ($node) {
$block->delta = $node->nid;
// TODO: the value is not available somehow?!?
$book_block_mode = isset($conf['book_block_mode']) ? $conf['book_block_mode'] : 'book pages';
// Code below is taken from function book_block_view().
$current_bid = empty($node->book['bid']) ? 0 : $node->book['bid'];
if ($book_block_mode === 'all pages') {
$block->subject = t('Book navigation');
$book_menus = array();
$pseudo_tree = array(0 => array('below' => FALSE));
foreach (book_get_books() as $book_id => $book) {
if ($book['bid'] === $current_bid) {
// If the current page is a node associated with a book, the menu
// needs to be retrieved.
$book_menus[$book_id] = menu_tree_output(menu_tree_all_data($node->book['menu_name'], $node->book));
}
else {
// Since we know we will only display a link to the top node, there
// is no reason to run an additional menu tree query for each book.
$book['in_active_trail'] = FALSE;
// Check whether user can access the book link.
$book_node = node_load($book['nid']);
$book['access'] = node_access('view', $book_node);
$pseudo_tree[0]['link'] = $book;
$book_menus[$book_id] = menu_tree_output($pseudo_tree);
}
}
$book_menus['#theme'] = 'book_all_books_block';
$block->content = $book_menus;
}
elseif ($current_bid) {
// Only display this block when the user is browsing a book.
$select = db_select('node', 'n')
->fields('n', array('title'))
->condition('n.nid', $node->book['bid'])
->addTag('node_access');
$title = $select->execute()->fetchField();
// Only show the block if the user has view access for the top-level node.
if ($title) {
$tree = menu_tree_all_data($node->book['menu_name'], $node->book);
// There should only be one element at the top level.
$data = array_shift($tree);
// TODO: subject is not rendered
$block->subject = theme('book_title_link', array('link' => $data['link']));
$block->content = ($data['below']) ? menu_tree_output($data['below']) : '';
}
}
}
else {
$block->content = t('Book navigation pager goes here.');
$block->delta = 'unknown';
}
return $block;
}
function ctools_node_book_menu_content_type_admin_title($subtype, $conf, $context) {
return t('"@s" book navigation pager', array('@s' => $context->identifier));
}
function ctools_node_book_menu_content_type_edit_form($form, &$form_state) {
// Grab block form from the book module.
$block_form = book_block_configure($delta = '');
// TODO: this does not work yet.
// See TODO in: ctools_node_book_menu_content_type_render
if (isset($form_state['input']['book_block_mode'])) {
$block_form['book_block_mode']['#default_value'] = $form_state['input']['book_block_mode'];
}
$form += $block_form;
return $form;
}

View File

@@ -7,9 +7,9 @@ if (module_exists('book')) {
*/
$plugin = array(
'single' => TRUE,
'title' => t('Book navigation'),
'icon' => 'icon_node.png',
'description' => t('The navigation menu the book the node belongs to.'),
'title' => t('Book navigation pager'),
'icon' => '../block/icon_core_booknavigation.png',
'description' => t('The navigational pager and sub pages of the current book node.'),
'required context' => new ctools_context_required(t('Node'), 'node'),
'category' => t('Node'),
);
@@ -20,13 +20,13 @@ function ctools_node_book_nav_content_type_render($subtype, $conf, $panel_args,
$block = new stdClass();
$block->module = 'book_nav';
$block->title = t('Book navigation');
$block->title = t('Book navigation pager');
if ($node) {
$block->content = isset($node->book) ? theme('book_navigation', array('book_link' => $node->book)) : '';
$block->delta = $node->nid;
}
else {
$block->content = t('Book navigation goes here.');
$block->content = t('Book navigation pager goes here.');
$block->delta = 'unknown';
}
@@ -34,7 +34,7 @@ function ctools_node_book_nav_content_type_render($subtype, $conf, $panel_args,
}
function ctools_node_book_nav_content_type_admin_title($subtype, $conf, $context) {
return t('"@s" book navigation', array('@s' => $context->identifier));
return t('"@s" book navigation pager', array('@s' => $context->identifier));
}
function ctools_node_book_nav_content_type_edit_form($form, &$form_state) {

View File

@@ -6,9 +6,9 @@ version = CTOOLS_MODULE_VERSION
dependencies[] = ctools
dependencies[] = color
; Information added by Drupal.org packaging script on 2016-10-16
version = "7.x-1.11"
; Information added by Drupal.org packaging script on 2016-11-22
version = "7.x-1.12"
core = "7.x"
project = "ctools"
datestamp = "1476581654"
datestamp = "1479787162"

View File

@@ -5,9 +5,9 @@ dependencies[] = ctools
package = Chaos tool suite
version = CTOOLS_MODULE_VERSION
; Information added by Drupal.org packaging script on 2016-10-16
version = "7.x-1.11"
; Information added by Drupal.org packaging script on 2016-11-22
version = "7.x-1.12"
core = "7.x"
project = "ctools"
datestamp = "1476581654"
datestamp = "1479787162"

View File

@@ -5,7 +5,7 @@ class CtoolsContextKeywordsSubstitutionTestCase extends DrupalWebTestCase {
return array(
'name' => 'Keywords substitution',
'description' => 'Verify that keywords are properly replaced with data.',
'group' => 'Chaos Tools Suite',
'group' => 'ctools',
);
}
@@ -51,6 +51,30 @@ class CtoolsContextKeywordsSubstitutionTestCase extends DrupalWebTestCase {
"%{$node->title}",
t('Keyword after escaped and unescaped percent sign has been replaced.'),
),
'%%foo:bar' => array(
"%foo:bar",
t('Non-existant context ignored.'),
),
'There was about 20%-30% difference in price.' => array(
'There was about 20%-30% difference in price.',
t('Non-keyword percent sign left untouched.'),
),
'href="my%20file%2dname.pdf"' => array(
'href="my%20file%2dname.pdf"',
t('HTTP URL escape left untouched.'),
),
'href="my%a0file%fdname.pdf"' => array(
'href="my%a0file%fdname.pdf"',
t('HTTP URL escape (high-chars) left untouched.'),
),
'<a href="http://www.example.com/here%20is%20a%20pdf.pdf">Click here!</a>' => array(
'<a href="http://www.example.com/here%20is%20a%20pdf.pdf">Click here!</a>',
t('HTTP URL escape percent sign left untouched in HTML.'),
),
'SELECT * FROM {table} WHERE field = "%s"' => array(
'SELECT * FROM {table} WHERE field = "%s"',
t('SQL percent sign left untouched.'),
),
);
foreach ($checks as $string => $expectations) {
list($expected_result, $message) = $expectations;

View File

@@ -12,7 +12,7 @@ class CtoolsCssTestCase extends DrupalWebTestCase {
return array(
'name' => 'CSS Tools tests',
'description' => '...',
'group' => 'Chaos Tools Suite',
'group' => 'ctools',
);
}

View File

@@ -16,7 +16,7 @@ class CtoolsObjectCache extends DrupalWebTestCase {
return array(
'name' => 'Ctools CSS cache',
'description' => 'Tests the custom CSS cache handler.',
'group' => 'Chaos Tools Suite',
'group' => 'ctools',
);
}

View File

@@ -12,7 +12,7 @@ class CtoolsPluginsGetInfoTestCase extends DrupalWebTestCase {
return array(
'name' => 'Get plugin info',
'description' => 'Verify that plugin type definitions can properly set and overide values.',
'group' => 'Chaos Tools Suite',
'group' => 'ctools',
);
}

View File

@@ -14,7 +14,7 @@ class CtoolsExportCrudTestCase extends DrupalWebTestCase {
return array(
'name' => 'CTools export CRUD tests',
'description' => 'Test the CRUD functionality for the ctools export system.',
'group' => 'Chaos Tools Suite',
'group' => 'ctools',
);
}

View File

@@ -8,9 +8,9 @@ hidden = TRUE
files[] = ctools_export.test
; Information added by Drupal.org packaging script on 2016-10-16
version = "7.x-1.11"
; Information added by Drupal.org packaging script on 2016-11-22
version = "7.x-1.12"
core = "7.x"
project = "ctools"
datestamp = "1476581654"
datestamp = "1479787162"

View File

@@ -12,9 +12,9 @@ files[] = math_expression.test
files[] = math_expression_stack.test
hidden = TRUE
; Information added by Drupal.org packaging script on 2016-10-16
version = "7.x-1.11"
; Information added by Drupal.org packaging script on 2016-11-22
version = "7.x-1.12"
core = "7.x"
project = "ctools"
datestamp = "1476581654"
datestamp = "1479787162"

View File

@@ -13,7 +13,7 @@ class CtoolsMathExpressionTestCase extends DrupalWebTestCase {
return array(
'name' => 'CTools math expression tests',
'description' => 'Test the math expression library of ctools.',
'group' => 'Chaos Tools Suite',
'group' => 'ctools',
);
}

View File

@@ -13,7 +13,7 @@ class CtoolsMathExpressionStackTestCase extends DrupalWebTestCase {
return array(
'name' => 'CTools math expression stack tests',
'description' => 'Test the stack class of the math expression library.',
'group' => 'Chaos Tools Suite',
'group' => 'ctools',
);
}

View File

@@ -12,7 +12,7 @@ class CtoolsObjectCache extends DrupalWebTestCase {
return array(
'name' => 'Ctools object cache storage',
'description' => 'Verify that objects are written, readable and lockable.',
'group' => 'Chaos Tools Suite',
'group' => 'ctools',
);
}

View File

@@ -10,9 +10,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 2016-10-16
version = "7.x-1.11"
; Information added by Drupal.org packaging script on 2016-11-22
version = "7.x-1.12"
core = "7.x"
project = "ctools"
datestamp = "1476581654"
datestamp = "1479787162"