summaryrefslogtreecommitdiff
path: root/kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types
diff options
context:
space:
mode:
authorTorsten Grote <t@grobox.de>2014-03-26 14:49:27 (GMT)
committerTorsten Grote <t@grobox.de>2014-03-26 14:49:27 (GMT)
commit2a4fb496aefa326019008b73a237d08ace558a37 (patch)
treec72172b16387c107f56bc74a33367c0c1f18d1e5 /kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types
parent059014fd0353a4ab2158b617e92f3dd735b5ef7d (diff)
parent7d56a926f3dfb5a75cb1c0bed7621bf6994a8528 (diff)
downloadkolab.org-www-2a4fb496aefa326019008b73a237d08ace558a37.tar.gz
Merge branch 'master' into productionproduction
Diffstat (limited to 'kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types')
-rw-r--r--kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/block/block.inc40
-rw-r--r--kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/comment/comment_reply_form.inc2
-rw-r--r--kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/custom/custom.inc5
-rw-r--r--kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/entity_context/entity_field.inc18
-rw-r--r--kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/entity_context/entity_field_extra.inc22
-rw-r--r--kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/form/entity_form_field.inc5
-rw-r--r--kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/page/page_slogan.inc4
-rw-r--r--kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/token/token.inc11
-rw-r--r--kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/user_context/profile_fields.inc2
9 files changed, 78 insertions, 31 deletions
diff --git a/kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/block/block.inc b/kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/block/block.inc
index 9d55e8a..7c551b9 100644
--- a/kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/block/block.inc
+++ b/kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/block/block.inc
@@ -40,6 +40,11 @@ function ctools_block_content_type_content_type($subtype_id) {
* of the form "$module . '_ctools_block_info'".
*/
function ctools_block_content_type_content_types() {
+ $types = &drupal_static(__FUNCTION__);
+ if (isset($types)) {
+ return $types;
+ }
+
$types = array();
foreach (module_implements('block_info') as $module) {
$module_blocks = module_invoke($module, 'block_info');
@@ -156,14 +161,16 @@ function ctools_block_content_type_render($subtype, $conf) {
$block->module = $module;
$block->delta = $delta;
- if ($module == 'block' && !empty($info) && isset($info->title)) {
- $block->title = $info->title;
- }
- else if (isset($block->subject)) {
- $block->title = $block->subject;
- }
- else {
- $block->title = NULL;
+ if (!isset($block->title)) {
+ if ($module == 'block' && !empty($info) && isset($info->title)) {
+ $block->title = $info->title;
+ }
+ else if (isset($block->subject)) {
+ $block->title = $block->subject;
+ }
+ else {
+ $block->title = NULL;
+ }
}
if (module_exists('block') && user_access('administer blocks')) {
@@ -286,13 +293,18 @@ function ctools_block_content_type_admin_info($subtype, $conf) {
list($module, $delta) = _ctools_block_get_module_delta($subtype, $conf);
$block = (object) module_invoke($module, 'block_view', $delta);
- // Sanitize the block because <script> tags can hose javascript up:
- if (!empty($block->content)) {
- $block->content = filter_xss_admin($block->content);
- }
+ if (!empty($block)) {
+ // Sanitize the block because <script> tags can hose javascript up:
+ if (!empty($block->content)) {
+ $block->content = filter_xss_admin(render($block->content));
+ }
- if (!empty($block) && !empty($block->subject)) {
- $block->title = $block->subject;
+ if (!empty($block->subject)) {
+ $block->title = $block->subject;
+ }
+ elseif (empty($block->title)) {
+ $block->title = t('No title');
+ }
return $block;
}
}
diff --git a/kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/comment/comment_reply_form.inc b/kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/comment/comment_reply_form.inc
index f31a702..c05effb 100644
--- a/kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/comment/comment_reply_form.inc
+++ b/kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/comment/comment_reply_form.inc
@@ -25,7 +25,7 @@ if (module_exists('comment')) {
function ctools_comment_reply_form_content_type_render($subtype, $conf, $panel_args, $context) {
- $comment = ($context[1]->identifier == 'No context') ? NULL : clone($context[1]->data);
+ $comment = ($context[1]->identifier == t('No context')) ? NULL : clone($context[1]->data);
$block = new stdClass();
$block->module = 'comments';
if ($comment) $block->delta = $comment->cid;
diff --git a/kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/custom/custom.inc b/kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/custom/custom.inc
index 4853feb..ac2f2a3 100644
--- a/kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/custom/custom.inc
+++ b/kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/custom/custom.inc
@@ -45,6 +45,11 @@ function ctools_custom_content_type_content_type($subtype_id) {
* Return all custom content types available.
*/
function ctools_custom_content_type_content_types() {
+ $types = &drupal_static(__FUNCTION__);
+ if (isset($types)) {
+ return $types;
+ }
+
ctools_include('export');
$types = array();
$types['custom'] = _ctools_default_content_type_content_type();
diff --git a/kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/entity_context/entity_field.inc b/kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/entity_context/entity_field.inc
index 2da4044..d7d6319 100644
--- a/kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/entity_context/entity_field.inc
+++ b/kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/entity_context/entity_field.inc
@@ -38,27 +38,33 @@ function ctools_entity_field_content_type_content_types() {
$context_types = array();
$entities = entity_get_info();
+ $description = t('Field on the referenced entity.');
+ $styles = t('Formatter Styles');
+ $categories = array();
foreach ($entities as $entity_type => $entity) {
+ $category = t(ucfirst($entity_type));
+ $categories[$entity_type] = $category;
foreach ($entity['bundles'] as $type => $bundle) {
foreach (field_info_instances($entity_type, $type) as $field_name => $field) {
if (!isset($types[$entity_type . ':' . $field_name])) {
+ $label = t($field['label']);
$types[$entity_type . ':' . $field_name] = array(
- 'category' => t(ucfirst($entity_type)),
+ 'category' => $category,
'icon' => 'icon_field.png',
'title' => t('Field: @widget_label (@field_name)', array(
- '@widget_label' => t($field['label']),
+ '@widget_label' => $label,
'@field_name' => $field_name,
)),
- 'description' => t('Field on the referenced entity.'),
+ 'description' => $description,
'edit form' => array(
'ctools_entity_field_content_type_formatter_options' => array(
'default' => TRUE,
'title' => t('Formatter options for: @widget_label (@field_name)', array(
- '@widget_label' => t($field['label']),
+ '@widget_label' => $label,
'@field_name' => $field_name,
)),
),
- 'ctools_entity_field_content_type_formatter_styles' => t('Formatter Styles'),
+ 'ctools_entity_field_content_type_formatter_styles' => $styles,
),
);
}
@@ -70,7 +76,7 @@ function ctools_entity_field_content_type_content_types() {
// Create the required context for each field related to the bundle types.
foreach ($types as $key => $field_content_type) {
list($entity_type, $field_name) = explode(':', $key, 2);
- $types[$key]['required context'] = new ctools_context_required(t(ucfirst($entity_type)), $entity_type, array(
+ $types[$key]['required context'] = new ctools_context_required($categories[$entity_type], $entity_type, array(
'type' => array_keys($context_types[$key]['types']),
));
unset($context_types[$key]['types']);
diff --git a/kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/entity_context/entity_field_extra.inc b/kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/entity_context/entity_field_extra.inc
index 807969c..6a59ed4 100644
--- a/kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/entity_context/entity_field_extra.inc
+++ b/kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/entity_context/entity_field_extra.inc
@@ -25,6 +25,11 @@ function ctools_entity_field_extra_content_type_content_type($subtype) {
*/
function ctools_entity_field_extra_content_type_content_types() {
// This will hold all the individual field content types.
+ $types = &drupal_static(__FUNCTION__);
+ if (isset($types)) {
+ return $types;
+ }
+
$types = array();
$context_types = array();
$entities = entity_get_info();
@@ -97,13 +102,20 @@ function ctools_entity_field_extra_content_type_render($subtype, $conf, $panel_a
$entity = clone $context->data;
list($entity_type, $field_name) = explode(':', $subtype, 2);
list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity);
-
- // Invoke the view-hook to get the extra field.
- $entity->content = array();
$langcode = $GLOBALS['language_content']->language;
- module_invoke_all($entity_type . '_view', $entity, $conf['view_mode'], $langcode);
- module_invoke_all('entity_view', $entity, $entity_type, $conf['view_mode'], $langcode);
+ $function = $entity_type . '_view';
+ if (in_array($entity_type, array('node', 'taxonomy_term', 'user')) && function_exists($function)) {
+ // Call known ENTITY_view() to get the extra field.
+ $entity->content = $function($entity, $conf['view_mode'], $langcode);
+ }
+ else {
+ // Invoke the view-hook to get the extra field.
+ $entity->content = array();
+
+ module_invoke_all($entity_type . '_view', $entity, $conf['view_mode'], $langcode);
+ module_invoke_all('entity_view', $entity, $entity_type, $conf['view_mode'], $langcode);
+ }
if (isset($entity->content[$field_name])) {
// Build the content type block.
diff --git a/kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/form/entity_form_field.inc b/kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/form/entity_form_field.inc
index 56fb76a..a030f69 100644
--- a/kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/form/entity_form_field.inc
+++ b/kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/form/entity_form_field.inc
@@ -30,6 +30,11 @@ function ctools_entity_form_field_content_type_content_type($subtype) {
*/
function ctools_entity_form_field_content_type_content_types() {
// This will hold all the individual field content types.
+ $types = &drupal_static(__FUNCTION__);
+ if (isset($types)) {
+ return $types;
+ }
+
$types = array();
$content_types = array();
$entities = entity_get_info();
diff --git a/kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/page/page_slogan.inc b/kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/page/page_slogan.inc
index 58f913f..d5cba38 100644
--- a/kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/page/page_slogan.inc
+++ b/kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/page/page_slogan.inc
@@ -14,7 +14,7 @@ $plugin = array(
'title' => t('Site slogan'),
'single' => TRUE,
'icon' => 'icon_page.png',
- 'description' => t('Add the slogan trail as content.'),
+ 'description' => t("Add the site's slogan as content."),
'category' => t('Page elements'),
'render last' => TRUE,
);
@@ -26,7 +26,7 @@ $plugin = array(
*/
function ctools_page_slogan_content_type_render($subtype, $conf, $panel_args) {
$block = new stdClass();
- $block->content = (theme_get_setting('toggle_slogan') ? filter_xss_admin(variable_get('site_slogan', '')) : '');
+ $block->content = filter_xss_admin(variable_get('site_slogan', ''));
return $block;
}
diff --git a/kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/token/token.inc b/kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/token/token.inc
index c43abd2..7b6f7fc 100644
--- a/kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/token/token.inc
+++ b/kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/token/token.inc
@@ -33,19 +33,26 @@ function ctools_token_content_type_content_type($subtype) {
*/
function ctools_token_content_type_content_types() {
// This will hold all the properties.
+ $types = &drupal_static(__FUNCTION__);
+ if (isset($types)) {
+ return $types;
+ }
+
$types = array();
$info = token_info();
foreach ($info['tokens'] as $entity_type => $tokens) {
+ $category = t('@entity (tokens)', array('@entity' => ucfirst($entity_type)));
+ $context = new ctools_context_required(t(ucfirst($entity_type)), $entity_type);
foreach ($tokens as $name => $token) {
if (!empty($token['name'])) {
$token += array('description' => '');
$types[$entity_type . ':' . $name] = array(
- 'category' => t('@entity (tokens)', array('@entity' => ucfirst($entity_type))),
+ 'category' => $category,
'icon' => 'icon_token.png',
'title' => $token['name'],
'description' => $token['description'],
- 'required context' => new ctools_context_required(t(ucfirst($entity_type)), $entity_type),
+ 'required context' => $context,
);
}
}
diff --git a/kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/user_context/profile_fields.inc b/kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/user_context/profile_fields.inc
index 2633fd3..55d5593 100644
--- a/kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/user_context/profile_fields.inc
+++ b/kolab.org/www/drupal-7.26/sites/all/modules/ctools/plugins/content_types/user_context/profile_fields.inc
@@ -1,6 +1,6 @@
<?php
-if (module_exists('profile') && !is_null(profile_user_categories())) {
+if (module_exists('profile') && !(defined('MAINTENANCE_MODE') && MAINTENANCE_MODE == 'update') && !is_null(profile_user_categories())) {
/**
* Plugins are described by creating a $plugin array which will be used
* by the system that includes this file.