contrib modules security updates
This commit is contained in:
93
sites/all/modules/panels/i18n_panels/README.txt
Normal file
93
sites/all/modules/panels/i18n_panels/README.txt
Normal file
@@ -0,0 +1,93 @@
|
||||
|
||||
This module provides by default the ability to translate panel display and
|
||||
panel pane titles.
|
||||
Further it introduced an extension to the ctools content_types plugin.
|
||||
You can now define translatable settings which will be registered in i18n.
|
||||
Out of the box the module extends the custom content content_type to allow
|
||||
translation of the content.
|
||||
|
||||
Requirements:
|
||||
Ctools 7.x-1.x-dev (Jan 28-2014 or newer)
|
||||
Panels 7.x-3.x-dev (Jan 28-2014 or newer)
|
||||
|
||||
Plugin definition extension:
|
||||
------------------------------
|
||||
|
||||
This example shows how the content_type custom is extended:
|
||||
|
||||
#### Default: ####
|
||||
/**
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
* by the system that includes this file.
|
||||
*/
|
||||
$plugin = array(
|
||||
'title' => t('Custom content'),
|
||||
'no title override' => TRUE,
|
||||
'defaults' => array('admin_title' => '', 'title' => '', 'body' => '', 'format' => filter_fallback_format(), 'substitute' => TRUE),
|
||||
'js' => array('misc/autocomplete.js', 'misc/textarea.js', 'misc/collapse.js'),
|
||||
// Make sure the edit form is only used for some subtypes.
|
||||
'edit form' => '',
|
||||
'add form' => '',
|
||||
'edit text' => t('Edit'),
|
||||
'all contexts' => TRUE,
|
||||
);
|
||||
|
||||
#### Extended Configuration: ####
|
||||
/**
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
* by the system that includes this file.
|
||||
*/
|
||||
$plugin = array(
|
||||
'title' => t('Custom content'),
|
||||
'no title override' => TRUE,
|
||||
'defaults' => array('admin_title' => '', 'title' => '', 'body' => '', 'format' => filter_fallback_format(), 'substitute' => TRUE),
|
||||
'js' => array('misc/autocomplete.js', 'misc/textarea.js', 'misc/collapse.js'),
|
||||
// Make sure the edit form is only used for some subtypes.
|
||||
'edit form' => '',
|
||||
'add form' => '',
|
||||
'edit text' => t('Edit'),
|
||||
'all contexts' => TRUE,
|
||||
'i18n_settings' = array(
|
||||
'title',
|
||||
'body' => array('format' => 'plain_text'),
|
||||
'items|0|title'
|
||||
),
|
||||
);
|
||||
|
||||
The new key "i18n_settings" defines an array with the settings that are
|
||||
translatable. The array contains the names of the settings, they have to be
|
||||
available in the "defaults" array of the content definition. If you need to
|
||||
define a format use the name of the setting as the array item key and as item
|
||||
another array with the detail configuration. E.g
|
||||
'i18n_settings' = array('body' => array('format' => 'plain_text'))
|
||||
|
||||
If i18n_settings is a string it's used as callback. The expected return is an
|
||||
array equal to the one used in the fix configuration.
|
||||
You can even declare nested settings as translatable, to do so use '|' as
|
||||
delimiter.
|
||||
E.g. 'items|0|title' is evaluated as $settings['items'][0]['title']
|
||||
|
||||
#### Callback: ####
|
||||
/**
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
* by the system that includes this file.
|
||||
*/
|
||||
$plugin = array(
|
||||
'title' => t('Custom content'),
|
||||
'no title override' => TRUE,
|
||||
'defaults' => array('admin_title' => '', 'title' => '', 'body' => '', 'format' => filter_fallback_format(), 'substitute' => TRUE),
|
||||
'js' => array('misc/autocomplete.js', 'misc/textarea.js', 'misc/collapse.js'),
|
||||
// Make sure the edit form is only used for some subtypes.
|
||||
'edit form' => '',
|
||||
'add form' => '',
|
||||
'edit text' => t('Edit'),
|
||||
'all contexts' => TRUE,
|
||||
'i18n_settings' => 'ctools_custom_content_type_i18n_settings',
|
||||
);
|
||||
|
||||
function ctools_custom_content_type_i18n_settings($conf) {
|
||||
return array(
|
||||
'title',
|
||||
'body' => array('format' => $conf['format']),
|
||||
);
|
||||
}
|
50
sites/all/modules/panels/i18n_panels/i18n_panels.i18n.inc
Normal file
50
sites/all/modules/panels/i18n_panels/i18n_panels.i18n.inc
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Internationalization (i18n) hooks
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_i18n_object_info().
|
||||
*/
|
||||
function i18n_panels_i18n_object_info() {
|
||||
$info['pane_configuration'] = array(
|
||||
'title' => t('Pane Configuration'),
|
||||
'key' => 'uuid',
|
||||
'string translation' => array(
|
||||
'textgroup' => 'panels',
|
||||
'type' => 'pane_configuration',
|
||||
'properties' => array(
|
||||
'title' => t('Pane Title'),
|
||||
),
|
||||
),
|
||||
);
|
||||
$info['display_configuration'] = array(
|
||||
'title' => t('Display Configuration'),
|
||||
'key' => 'uuid',
|
||||
'string translation' => array(
|
||||
'textgroup' => 'panels',
|
||||
'type' => 'display_configuration',
|
||||
'properties' => array(
|
||||
'title' => t('Display Title'),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
return $info;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_i18n_string_info().
|
||||
*/
|
||||
function i18n_panels_i18n_string_info() {
|
||||
$groups['panels'] = array(
|
||||
'title' => t('Panels'),
|
||||
'description' => t('Translatable panels items: display and pane configuration items. E.g. Title.'),
|
||||
// This group doesn't have strings with format.
|
||||
'format' => FALSE,
|
||||
// This group can list all strings.
|
||||
'list' => FALSE,
|
||||
);
|
||||
return $groups;
|
||||
}
|
15
sites/all/modules/panels/i18n_panels/i18n_panels.info
Normal file
15
sites/all/modules/panels/i18n_panels/i18n_panels.info
Normal file
@@ -0,0 +1,15 @@
|
||||
name = Panels translation
|
||||
description = Supports translatable panels items.
|
||||
dependencies[] = i18n
|
||||
dependencies[] = panels
|
||||
dependencies[] = i18n_string
|
||||
dependencies[] = i18n_translation
|
||||
package = Multilingual - Internationalization
|
||||
core = 7.x
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-08-20
|
||||
version = "7.x-3.7"
|
||||
core = "7.x"
|
||||
project = "panels"
|
||||
datestamp = "1471704242"
|
||||
|
27
sites/all/modules/panels/i18n_panels/i18n_panels.install
Normal file
27
sites/all/modules/panels/i18n_panels/i18n_panels.install
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Internationalization (i18n) submodule: Panels translation.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_requirements().
|
||||
*/
|
||||
function i18n_panels_requirements($phase) {
|
||||
$requirements = array();
|
||||
// Check only for status report, to allow update / install.
|
||||
if ($phase == 'runtime') {
|
||||
// Check if the panels module runs with uuids.
|
||||
$requirements['uuid'] = array(
|
||||
'title' => t('Panels uuid support.'),
|
||||
'severity' => REQUIREMENT_OK,
|
||||
'value' => t('Available'),
|
||||
);
|
||||
if (!db_field_exists('panels_pane', 'uuid')) {
|
||||
$requirements['uuid']['severity'] = REQUIREMENT_ERROR;
|
||||
$requirements['uuid']['value'] = t('Not found. Please apply the provided patches and run the update script.');
|
||||
}
|
||||
}
|
||||
return $requirements;
|
||||
}
|
442
sites/all/modules/panels/i18n_panels/i18n_panels.module
Normal file
442
sites/all/modules/panels/i18n_panels/i18n_panels.module
Normal file
@@ -0,0 +1,442 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Internationalization (i18n) submodule: Panels translation.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fetch the i18n_settings of the content type if there are any.
|
||||
*
|
||||
* @param stdClass $pane
|
||||
* The pane to deal with.
|
||||
*
|
||||
* @return array|false
|
||||
* Settings or FALSE if none are present.
|
||||
*/
|
||||
function i18n_panels_get_i18n_settings($pane) {
|
||||
ctools_include('content');
|
||||
$content_type = ctools_get_content_type($pane->type);
|
||||
if (isset($content_type['i18n_settings'])) {
|
||||
if (is_string($content_type['i18n_settings']) && function_exists($content_type['i18n_settings'])) {
|
||||
$content_type['i18n_settings'] = $content_type['i18n_settings']($pane->configuration);
|
||||
}
|
||||
}
|
||||
// Provide the override title string as translation for all panes that have
|
||||
// this setting enabled.
|
||||
if (isset($pane->configuration['override_title']) && $pane->configuration['override_title']) {
|
||||
if (isset($content_type['i18n_settings']) && is_array($content_type['i18n_settings'])) {
|
||||
$content_type['i18n_settings'][] = 'override_title_text';
|
||||
}
|
||||
else {
|
||||
$content_type['i18n_settings'] = array('override_title_text');
|
||||
}
|
||||
}
|
||||
return isset($content_type['i18n_settings']) ? $content_type['i18n_settings'] : FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the translation object of the pane.
|
||||
*
|
||||
* @param stdClass $pane
|
||||
* The pane to deal with.
|
||||
*
|
||||
* @return stdClass|FALSE
|
||||
* Returns FALSE if no translation is necessary.
|
||||
*/
|
||||
function i18n_panels_get_i18n_translation_object($pane) {
|
||||
$translation_object = array();
|
||||
|
||||
// Handle content type specific i18n settings.
|
||||
if ($i18n_settings = i18n_panels_get_i18n_settings($pane)) {
|
||||
// Register translatable settings.
|
||||
foreach ($i18n_settings as $i18n_setting => $settings) {
|
||||
if (!is_array($settings)) {
|
||||
$i18n_setting = $settings;
|
||||
$settings = array('format' => 'plain_text');
|
||||
}
|
||||
$translation_object[$i18n_setting] = NULL;
|
||||
$key_exists = FALSE;
|
||||
// Ensure a nested setting is "unpacked".
|
||||
$config_value = drupal_array_get_nested_value($pane->configuration, explode('|', $i18n_setting), $key_exists);
|
||||
// If we reached the end of the nested setting use the value as source.
|
||||
if ($key_exists) {
|
||||
$translation_object[$i18n_setting] = array(
|
||||
'string' => $config_value,
|
||||
'format' => $settings['format'],
|
||||
);
|
||||
$translation_object['panels_i18n_settings'][$i18n_setting] = $settings;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check if this pane has a custom title enabled.
|
||||
if (!empty($pane->configuration['override_title'])) {
|
||||
$translation_object['title']['string'] = $pane->configuration['override_title_text'];
|
||||
}
|
||||
if (!empty($translation_object)) {
|
||||
return (object) $translation_object;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_panels_pane_insert().
|
||||
*
|
||||
* @param stdClass $pane
|
||||
* The pane to deal with.
|
||||
*/
|
||||
function i18n_panels_panels_pane_insert($pane) {
|
||||
i18n_panels_panels_pane_update($pane);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_panels_pane_update().
|
||||
*
|
||||
* @param stdClass $pane
|
||||
* The pane to deal with.
|
||||
*/
|
||||
function i18n_panels_panels_pane_update($pane) {
|
||||
if ($translation_object = i18n_panels_get_i18n_translation_object($pane)) {
|
||||
$translation_object->uuid = $pane->uuid;
|
||||
$status = i18n_string_object_update('pane_configuration', $translation_object);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_panels_pane_delete().
|
||||
*
|
||||
* @param array $pids
|
||||
* Array with the panel ids to delete.
|
||||
*/
|
||||
function i18n_panels_panels_pane_delete($pids) {
|
||||
if (!empty($pids)) {
|
||||
// Fetch the uuids from the db.
|
||||
$uuids = db_select('panels_pane')
|
||||
->fields('panels_pane', array('uuid'))
|
||||
->condition('pid', $pids)
|
||||
->execute()
|
||||
->fetchCol();
|
||||
foreach ($uuids as $uuid) {
|
||||
// Create dummy pane with uuid as property.
|
||||
$pane = (object) array('uuid' => $uuid);
|
||||
i18n_string_object_remove('pane_configuration', $pane);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_panels_pane_prerender().
|
||||
*
|
||||
* @param stdClass $pane
|
||||
* The pane to deal with.
|
||||
*/
|
||||
function i18n_panels_panels_pane_prerender($pane) {
|
||||
// Check if this pane has translations.
|
||||
if (isset($pane->uuid) && $translation_object = i18n_panels_get_i18n_translation_object($pane)) {
|
||||
$translation_object->uuid = $pane->uuid;
|
||||
// Send to translation.
|
||||
$translation_object = i18n_string_object_translate('pane_configuration', $translation_object);
|
||||
unset($translation_object->uuid, $translation_object->i18n_settings);
|
||||
foreach ($translation_object as $i18n_setting => $translated_setting) {
|
||||
if ($i18n_setting != 'panels_i18n_settings') {
|
||||
if (is_array($translated_setting)) {
|
||||
$translated_setting = $translated_setting['string'];
|
||||
}
|
||||
drupal_array_set_nested_value($pane->configuration, explode('|', $i18n_setting), $translated_setting);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_panels_display_save().
|
||||
*
|
||||
* @param panels_display $display
|
||||
* The display to deal with.
|
||||
*/
|
||||
function i18n_panels_panels_display_save($display) {
|
||||
$status = i18n_string_object_update('display_configuration', $display);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_panels_display_delete().
|
||||
*
|
||||
* @param int $did
|
||||
* Id of the display to delete.
|
||||
*/
|
||||
function i18n_panels_panels_delete_display($did) {
|
||||
// Fetch uuid to delete the translations.
|
||||
$uuid = db_select('panels_display')
|
||||
->fields('panels_display', array('uuid'))
|
||||
->condition('did', $did)
|
||||
->execute()
|
||||
->fetchColumn();
|
||||
// Build a dummy display.
|
||||
$display = (object) array('uuid' => $uuid);
|
||||
|
||||
// Check if this display was just saved in the db.
|
||||
if (!_18n_panels_is_exported_panels_display($display)) {
|
||||
// If the display was just saved in the db remove all translations.
|
||||
i18n_string_object_remove('display_configuration', $display);
|
||||
// Remove related pane translations too.
|
||||
$pids = db_select('panels_pane')
|
||||
->fields('panels_pane', array('pid'))
|
||||
->condition('did', $did)
|
||||
->execute()
|
||||
->fetchCol();
|
||||
i18n_panels_panels_pane_delete($pids);
|
||||
}
|
||||
else {
|
||||
// If the display is exported leave the translated strings but give the user
|
||||
// a hint how to clean up.
|
||||
drupal_set_message(
|
||||
t(
|
||||
'The reverted panels display(s) were exported, please run a <a href="!link">string refresh</a> to update the translatable strings.',
|
||||
array('!link' => url('admin/config/regional/translate/i18n_string'))
|
||||
),
|
||||
'warning',
|
||||
FALSE
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_panels_pre_render().
|
||||
*
|
||||
* This function must not rely on the passed $renderer parameter. The parameter
|
||||
* could be empty because this function is reused in i18n_ctools_render_alter().
|
||||
* @todo Check if a drupal_alter() in panels_display::get_title() is applicable.
|
||||
*
|
||||
* @see i18n_ctools_render_alter()
|
||||
*
|
||||
* @param panels_display $display
|
||||
* The display to deal with.
|
||||
* @param panels_renderer_standard $renderer
|
||||
* The renderer to deal with.
|
||||
*/
|
||||
function i18n_panels_panels_pre_render(&$display, $renderer) {
|
||||
// Avoid double translations.
|
||||
if (!isset($display->i18n_panels_title_translated)) {
|
||||
$translation = i18n_string_object_translate('display_configuration', $display);
|
||||
if (is_array($translation->title)) {
|
||||
$display->title = $translation->title['string'];
|
||||
}
|
||||
else {
|
||||
$display->title = $translation->title;
|
||||
}
|
||||
$display->i18n_panels_title_translated = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_ctools_render_alter().
|
||||
*
|
||||
* Under some circumstances the title of the panel page is set before
|
||||
* hook_panels_pre_render() is fired. Such cases can be handled with this hook.
|
||||
* @todo Check if a drupal_alter() in panels_display::get_title() is applicable.
|
||||
*/
|
||||
function i18n_ctools_render_alter(&$info, $page, $context) {
|
||||
// @todo Find a better way to detect a panels page.
|
||||
if ($page === TRUE && !empty($info['content']['#display']) && $info['content']['#display'] instanceof panels_display) {
|
||||
i18n_panels_panels_pre_render($info['content']['#display'], NULL);
|
||||
// Set the info title. This is used to set the page title.
|
||||
$info['title'] = $info['content']['#display']->get_title();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_ctools_plugin_post_alter().
|
||||
*
|
||||
* Register some translatable configuration settings for plugins.
|
||||
*
|
||||
*/
|
||||
function i18n_panels_ctools_plugin_post_alter(&$plugin, $plugin_type_info) {
|
||||
if ($plugin_type_info['type'] == 'content_types') {
|
||||
// Modify custom content.
|
||||
if ($plugin['name'] == 'custom') {
|
||||
// Register callback to get the translatable settings.
|
||||
$plugin['i18n_settings'] = 'ctools_custom_content_type_i18n_settings';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback to provide the translatable settings appropriate to the config.
|
||||
*
|
||||
* @param array $conf
|
||||
* Content type configuration.
|
||||
*
|
||||
* @return array
|
||||
* i18n_settings configuration.
|
||||
*/
|
||||
function ctools_custom_content_type_i18n_settings($conf) {
|
||||
return array(
|
||||
'title',
|
||||
'body' => array('format' => $conf['format']),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_i18n_string_list_TEXTGROUP_alter().
|
||||
*
|
||||
* Necessary to support the dynamic translatable settings defined by ctools
|
||||
* content types.
|
||||
*/
|
||||
function i18n_panels_i18n_string_list_panels_alter(&$strings, $type = NULL, $object = NULL) {
|
||||
if (isset($object->panels_i18n_settings)) {
|
||||
foreach ($object->panels_i18n_settings as $i18n_setting => $settings) {
|
||||
if (isset($object->{$i18n_setting})) {
|
||||
$strings['panels'][$type][$object->uuid][$i18n_setting] = $object->{$i18n_setting};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_i18n_string_list().
|
||||
*
|
||||
* @todo Figure out a generic solution to fetch exported displays.
|
||||
*/
|
||||
function i18n_panels_i18n_string_list($group) {
|
||||
$strings = array();
|
||||
if ($group == 'panels') {
|
||||
|
||||
// Fetch all available displays.
|
||||
$displays = _18n_panels_fetch_all_panel_displays();
|
||||
|
||||
foreach ($displays as $display) {
|
||||
if (empty($display->uuid)) {
|
||||
drupal_set_message(t('The display %display has no uuid, please resave or re-export it.', array('%display' => $display->did)), 'warning');
|
||||
continue;
|
||||
}
|
||||
// Avoid duplicated runs _18n_panels_fetch_all_panel_displays() probably
|
||||
// returns the same display twice, one for the db based and one for the
|
||||
// exported one.
|
||||
if (isset($strings['panels']['display_configuration'][$display->uuid])) {
|
||||
continue;
|
||||
}
|
||||
$strings['panels']['display_configuration'][$display->uuid]['title']['string'] = $display->title;
|
||||
foreach ($display->content as $pane) {
|
||||
if (empty($pane->uuid)) {
|
||||
// Fetch exported uuid and validate it.
|
||||
$uuid = str_replace('new-', '', $pane->pid);
|
||||
if (!panels_uuid_is_valid($uuid)) {
|
||||
drupal_set_message(t('The pane %pane has no uuid, please resave or re-export it.', array('%pane' => $pane->pid)), 'warning');
|
||||
continue;
|
||||
}
|
||||
$pane->uuid = $uuid;
|
||||
}
|
||||
if ($translation_object = i18n_panels_get_i18n_translation_object($pane)) {
|
||||
// Split up all strings and add them to the list.
|
||||
$pane_strings = (array) $translation_object;
|
||||
unset($pane_strings['panels_i18n_settings']);
|
||||
foreach ($pane_strings as $key => $pane_string) {
|
||||
$strings['panels']['pane_configuration'][$pane->uuid][$key] = $pane_string;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $strings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the give display is exported or only stored in the db.
|
||||
*
|
||||
* @return boolean
|
||||
* TRUE if the display is available from code.
|
||||
*/
|
||||
function _18n_panels_is_exported_panels_display($display) {
|
||||
if (isset($display->uuid)) {
|
||||
$displays = _18n_panels_fetch_all_panel_displays();
|
||||
return isset($displays['exported-' . $display->uuid]);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of really all available panel displays.
|
||||
*
|
||||
* The list is statically cached. Use the parameter $reset to refresh the list
|
||||
* during the same request.
|
||||
* Probably returns the same display twice - once with the db based and once
|
||||
* the exported one.
|
||||
*
|
||||
* @todo I bet there are better ways to solve this mess.
|
||||
*
|
||||
* @param boolean $reset
|
||||
* Reset the static cache.
|
||||
*
|
||||
* @return array
|
||||
* List of all panel displays.
|
||||
*/
|
||||
function _18n_panels_fetch_all_panel_displays($reset = FALSE) {
|
||||
$displays = &drupal_static(__FUNCTION__, array());
|
||||
if (!empty($displays) && !$reset) {
|
||||
return $displays;
|
||||
}
|
||||
|
||||
// Fetch db based displays.
|
||||
$dids = db_select('panels_display')->fields('panels_display', array('did'))->execute()->fetchCol();
|
||||
$displays = panels_load_displays($dids);
|
||||
|
||||
// Fetch exported displays.
|
||||
ctools_include('export');
|
||||
foreach (ctools_export_crud_load_all('panels_display') as $panels_display) {
|
||||
if (!empty($panels_display->uuid)) {
|
||||
$displays['exported-' . $panels_display->uuid] = $panels_display;
|
||||
}
|
||||
}
|
||||
|
||||
// Fetch mini panels.
|
||||
$mini_panels = ctools_export_crud_load_all('panels_mini');
|
||||
foreach ($mini_panels as $pane) {
|
||||
if (!empty($pane->display->uuid)) {
|
||||
$displays['exported-' . $pane->display->uuid] = $pane->display;
|
||||
}
|
||||
}
|
||||
|
||||
// Fetch in page manager embedded displays.
|
||||
if (module_exists('page_manager')) {
|
||||
module_load_include('inc', 'page_manager', 'page_manager.admin');
|
||||
$tasks = page_manager_get_tasks_by_type('page');
|
||||
$pages = array('operations' => array(), 'tasks' => array());
|
||||
page_manager_get_pages($tasks, $pages);
|
||||
|
||||
foreach ($pages['tasks'] as $task) {
|
||||
$page = page_manager_cache_load($task);
|
||||
$task_info = page_manager_get_task_subtasks($page->task);
|
||||
foreach ($page->handler_info as $id => $info) {
|
||||
$page_manager_handler = $page->handlers[$id];
|
||||
if ($page_manager_handler->handler == 'panel_context') {
|
||||
|
||||
// @todo Is there really no better way to check this?
|
||||
$is_exported = ($page_manager_handler->export_type == (EXPORT_IN_CODE | EXPORT_IN_DATABASE) || (isset($page->subtask['storage']) && $page->subtask['storage'] == t('Overridden')));
|
||||
|
||||
if (!empty($page_manager_handler->conf['display'])) {
|
||||
$panels_display = $page_manager_handler->conf['display'];
|
||||
$displays['exported-' . $panels_display->uuid] = $panels_display;
|
||||
}
|
||||
elseif ($is_exported && isset($page_manager_handler->conf['did'])) {
|
||||
$panels_display = panels_load_display($page_manager_handler->conf['did']);
|
||||
if (isset($panels_display->uuid)) {
|
||||
$displays['exported-' . $panels_display->uuid] = $panels_display;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fetch panelizer displays.
|
||||
if (module_exists('panelizer')) {
|
||||
// Fetch all default handlers.
|
||||
$panelizer_defaults = ctools_export_crud_load_all('panelizer_defaults');
|
||||
foreach ($panelizer_defaults as $panelizer_default) {
|
||||
$displays['exported-' . $panelizer_default->display->uuid] = $panelizer_default->display;
|
||||
}
|
||||
}
|
||||
return $displays;
|
||||
}
|
Reference in New Issue
Block a user