all contrib module security updates done
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Plugin to provide access control based on whether a node belongs to a book.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
* by the system that includes this file.
|
||||
*/
|
||||
if (module_exists('book')) {
|
||||
$plugin = array(
|
||||
'title' => t("Book: node is in a book"),
|
||||
'description' => t('Control access based upon a node belonging to a book.'),
|
||||
'callback' => 'ctools_book_node_ctools_access_check',
|
||||
'default' => array('book' => array()),
|
||||
'settings form' => 'ctools_book_node_ctools_access_settings',
|
||||
'settings form submit' => 'ctools_book_node_ctools_access_settings_submit',
|
||||
'summary' => 'ctools_book_node_ctools_access_summary',
|
||||
'required context' => new ctools_context_required(t('Node'), 'node'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings form for the 'by book_node' access plugin.
|
||||
*/
|
||||
function ctools_book_node_ctools_access_settings($form, &$form_state, $conf) {
|
||||
$options = array(
|
||||
'any' => t('In any book'),
|
||||
);
|
||||
$books = book_get_books();
|
||||
foreach ($books as $bid => $book) {
|
||||
$options[$bid] = $book['title'];
|
||||
}
|
||||
$form['settings']['book'] = array(
|
||||
'#title' => t('Book'),
|
||||
'#type' => 'checkboxes',
|
||||
'#options' => $options,
|
||||
'#description' => t('Pass only if the node belongs to one of the selected books'),
|
||||
'#default_value' => $conf['book'],
|
||||
'#required' => TRUE,
|
||||
);
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for access.
|
||||
*/
|
||||
function ctools_book_node_ctools_access_check($conf, $context) {
|
||||
// As far as I know there should always be a context at this point, but this
|
||||
// is safe.
|
||||
if (empty($context) || empty($context->data) || empty($context->data->book)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ($conf['book']['any']) {
|
||||
return !empty($context->data->book);
|
||||
}
|
||||
|
||||
foreach ($conf['book'] as $bid => $value) {
|
||||
if ($bid == 'any') {
|
||||
continue;
|
||||
}
|
||||
if ($value && ($bid == $context->data->book['bid'])) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide a summary description based upon the checked node_languages.
|
||||
*/
|
||||
function ctools_book_node_ctools_access_summary($conf, $context) {
|
||||
if ($conf['book']['any']) {
|
||||
return t('@identifier belongs to a book', array('@identifier' => $context->identifier));
|
||||
}
|
||||
|
||||
$books = array();
|
||||
foreach ($conf['book'] as $bid => $value) {
|
||||
if ($value) {
|
||||
$node = node_load($bid);
|
||||
$books[] = $node->title;
|
||||
}
|
||||
}
|
||||
|
||||
if (count($books) == 1) {
|
||||
return t('@identifier belongs to the book "@book"', array('@book' => $books[0], '@identifier' => $context->identifier));
|
||||
}
|
||||
|
||||
return t('@identifier belongs in multiple books', array('@identifier' => $context->identifier));
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Ctools access plugin to provide access/visiblity if two user contexts are equal.
|
||||
* CTools access plugin to provide access/visiblity if two user contexts are equal.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -20,12 +20,12 @@ $plugin = array(
|
||||
'summary' => 'ctools_compare_users_ctools_access_summary',
|
||||
'required context' => array(
|
||||
new ctools_context_required(t('First User'), 'user'),
|
||||
new ctools_context_required(t("Second User"), 'user')
|
||||
new ctools_context_required(t("Second User"), 'user'),
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings form for the 'by perm' access plugin
|
||||
* Settings form for the 'by perm' access plugin.
|
||||
*/
|
||||
function ctools_compare_users_settings($form, &$form_state, $conf) {
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Plugin to provide access control/visibility based on existence of a specified context
|
||||
* Plugin to provide access control/visibility based on existence of a specified context.
|
||||
*/
|
||||
|
||||
$plugin = array(
|
||||
@@ -16,7 +16,7 @@ $plugin = array(
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings form
|
||||
* Settings form.
|
||||
*/
|
||||
function ctools_context_exists_ctools_access_settings($form, &$form_state, $conf) {
|
||||
$form['settings']['exists'] = array(
|
||||
@@ -29,17 +29,17 @@ function ctools_context_exists_ctools_access_settings($form, &$form_state, $conf
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for access
|
||||
* Check for access.
|
||||
*/
|
||||
function ctools_context_exists_ctools_access_check($conf, $context) {
|
||||
// xor returns false if the two bools are the same, and true if they are not.
|
||||
// Xor returns false if the two bools are the same, and true if they are not.
|
||||
// i.e, if we asked for context_exists and it does, return true.
|
||||
// If we asked for context does not exist and it does, return false.
|
||||
return (empty($context->data) xor !empty($conf['exists']));
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide a summary description based upon the specified context
|
||||
* Provide a summary description based upon the specified context.
|
||||
*/
|
||||
function ctools_context_exists_ctools_access_summary($conf, $context) {
|
||||
if (!empty($conf['exists'])) {
|
||||
|
||||
@@ -43,7 +43,7 @@ function ctools_entity_bundle_ctools_access_get_children($plugin, $parent) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings form for the 'by entity_bundle' access plugin
|
||||
* Settings form for the 'by entity_bundle' access plugin.
|
||||
*/
|
||||
function ctools_entity_bundle_ctools_access_settings($form, &$form_state, $conf) {
|
||||
$plugin = $form_state['plugin'];
|
||||
@@ -133,4 +133,3 @@ function ctools_entity_bundle_ctools_access_summary($conf, $context, $plugin) {
|
||||
|
||||
return format_plural(count($names), '@identifier is bundle "@types"', '@identifier bundle is one of "@types"', array('@types' => implode(', ', $names), '@identifier' => $context->identifier));
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ $plugin = array(
|
||||
'get child' => 'ctools_entity_field_value_ctools_access_get_child',
|
||||
'get children' => 'ctools_entity_field_value_ctools_access_get_children',
|
||||
);
|
||||
function ctools_entity_field_value_ctools_access_get_child($plugin, $parent, $child) {
|
||||
|
||||
function ctools_entity_field_value_ctools_access_get_child($plugin, $parent, $child) {
|
||||
$plugins = &drupal_static(__FUNCTION__, array());
|
||||
if (empty($plugins[$parent . ':' . $child])) {
|
||||
list($entity_type, $bundle_type, $field_name) = explode(':', $child);
|
||||
@@ -48,8 +48,7 @@ function ctools_entity_field_value_ctools_access_get_children($plugin, $parent)
|
||||
}
|
||||
|
||||
function _ctools_entity_field_value_ctools_access_get_child($plugin, $parent, $entity_type, $bundle_type, $field_name, $entity = NULL, $bundle = NULL, $field = NULL) {
|
||||
|
||||
// check that the entity, bundle and field arrays have a value.
|
||||
// Check that the entity, bundle and field arrays have a value.
|
||||
// If not, load theme using machine names.
|
||||
if (empty($entity)) {
|
||||
$entity = entity_get_info($entity_type);
|
||||
@@ -69,14 +68,14 @@ function _ctools_entity_field_value_ctools_access_get_child($plugin, $parent, $e
|
||||
$plugin['description'] = t('Control access by @entity entity bundle.', array('@entity' => $entity_type));
|
||||
$plugin['name'] = $parent . ':' . $entity_type . ':' . $bundle_type . ':' . $field_name;
|
||||
$plugin['required context'] = new ctools_context_required(t(ucfirst($entity_type)), $entity_type, array(
|
||||
'type' => $bundle_type,
|
||||
));
|
||||
'type' => $bundle_type,
|
||||
));
|
||||
|
||||
return $plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings form for the 'by entity_bundle' access plugin
|
||||
* Settings form for the 'by entity_bundle' access plugin.
|
||||
*/
|
||||
function ctools_entity_field_value_ctools_access_settings($form, &$form_state, $conf) {
|
||||
$plugin = $form_state['plugin'];
|
||||
@@ -86,39 +85,44 @@ function ctools_entity_field_value_ctools_access_settings($form, &$form_state, $
|
||||
$instance = $instances[$field_name];
|
||||
$field = field_info_field_by_id($instance['field_id']);
|
||||
foreach ($field['columns'] as $column => $attributes) {
|
||||
$columns[] = _field_sql_storage_columnname($field_name, $column);
|
||||
$columns[$column] = _field_sql_storage_columnname($field_name, $column);
|
||||
}
|
||||
ctools_include('fields');
|
||||
$entity = (object)array(
|
||||
$entity = (object) array(
|
||||
$entity_info['entity keys']['bundle'] => $bundle_type,
|
||||
);
|
||||
$langcode = field_valid_language(NULL);
|
||||
$form['settings'] += (array) ctools_field_invoke_field($instance, 'form', $entity_type, $entity, $form, $form_state, array('default' => TRUE, 'language' => $langcode));
|
||||
// weight is really not important once this is populated and will only interfere with the form layout.
|
||||
foreach (element_children($form['settings']) as $element) {
|
||||
unset($form['settings'][$element]['#weight']);
|
||||
}
|
||||
|
||||
// Need more logic here to handle compound fields.
|
||||
foreach ($columns as $column) {
|
||||
if (isset($conf[$column]) && is_array($conf[$column])) {
|
||||
foreach ($conf[$column] as $delta => $conf_value) {
|
||||
if (is_numeric($delta) && is_array($conf_value)) {
|
||||
$form['settings'][$field_name][LANGUAGE_NONE][$delta]['value']['#default_value'] = $conf_value['value'];
|
||||
foreach ($columns as $column => $sql_column) {
|
||||
if (isset($conf[$sql_column])) {
|
||||
if (is_array($conf[$sql_column])) {
|
||||
foreach ($conf[$sql_column] as $delta => $conf_value) {
|
||||
if (is_numeric($delta)) {
|
||||
if (is_array($conf_value)) {
|
||||
$entity->{$field_name}[LANGUAGE_NONE][$delta][$column] = $conf_value[$column];
|
||||
}
|
||||
else {
|
||||
$entity->{$field_name}[LANGUAGE_NONE][$delta][$column] = $conf_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$entity->{$field_name}[LANGUAGE_NONE][0][$column] = $conf[$sql_column];
|
||||
}
|
||||
}
|
||||
else {
|
||||
$form['settings'][$field_name][LANGUAGE_NONE]['#default_value'] = $conf[$column];
|
||||
}
|
||||
}
|
||||
|
||||
$form['#parents'] = array('settings');
|
||||
$langcode = field_valid_language(NULL);
|
||||
$form['settings'] += (array) ctools_field_invoke_field($instance, 'form', $entity_type, $entity, $form, $form_state, array('default' => TRUE, 'language' => $langcode));
|
||||
// Weight is really not important once this is populated and will only interfere with the form layout.
|
||||
foreach (element_children($form['settings']) as $element) {
|
||||
unset($form['settings'][$element]['#weight']);
|
||||
}
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compress the entity bundles allowed to the minimum.
|
||||
*/
|
||||
function ctools_entity_field_value_ctools_access_settings_submit($form, &$form_state) {
|
||||
$plugin = $form_state['plugin'];
|
||||
list($parent, $entity_type, $bundle_type, $field_name) = explode(':', $plugin['name']);
|
||||
@@ -128,17 +132,83 @@ function ctools_entity_field_value_ctools_access_settings_submit($form, &$form_s
|
||||
$instance = $instances[$field_name];
|
||||
$field = field_info_field_by_id($instance['field_id']);
|
||||
foreach ($field['columns'] as $column => $attributes) {
|
||||
$columns[] = _field_sql_storage_columnname($field_name, $column);
|
||||
$columns[$column] = _field_sql_storage_columnname($field_name, $column);
|
||||
}
|
||||
$items = _ctools_entity_field_value_get_proper_form_items($field, $form_state['values']['settings'][$field_name][$langcode], array_keys($columns));
|
||||
foreach ($columns as $column => $sql_column) {
|
||||
$column_items = _ctools_entity_field_value_filter_items_by_column($items, $column);
|
||||
$form_state['values']['settings'][$sql_column] = $column_items;
|
||||
}
|
||||
$form_state['values']['settings'][$field_name][$langcode] = $items;
|
||||
}
|
||||
|
||||
function _ctools_entity_field_value_get_proper_form_items($field, $form_items, $columns) {
|
||||
$items = array();
|
||||
|
||||
// Single value item.
|
||||
if (!is_array($form_items)) {
|
||||
foreach ($columns as $column) {
|
||||
$items[0][$column] = $form_items;
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
|
||||
foreach ($form_items as $delta => $value) {
|
||||
$item = array();
|
||||
if (is_numeric($delta)) { // Array of field values.
|
||||
if (!is_array($value)) { // Single value in array.
|
||||
foreach ($columns as $column) {
|
||||
$item[$column] = $value;
|
||||
}
|
||||
}
|
||||
else { // Value has colums.
|
||||
foreach ($columns as $column) {
|
||||
$item[$column] = isset($value[$column]) ? $value[$column] : '';
|
||||
}
|
||||
}
|
||||
}
|
||||
$items[] = $item;
|
||||
}
|
||||
|
||||
// Check if $form_items is an array of columns.
|
||||
$item = array();
|
||||
$has_columns = FALSE;
|
||||
foreach ($columns as $column) {
|
||||
$form_state['values']['settings'][$column] = $form_state['input']['settings'][$field_name][$langcode];
|
||||
if (isset($form_items[$column])) {
|
||||
$has_columns = TRUE;
|
||||
$item[$column] = $form_items[$column];
|
||||
}
|
||||
else {
|
||||
$item[$column] = '';
|
||||
}
|
||||
}
|
||||
if ($has_columns) {
|
||||
$items[] = $item;
|
||||
}
|
||||
|
||||
// Remove empty values.
|
||||
$items = _field_filter_items($field, $items);
|
||||
return $items;
|
||||
}
|
||||
|
||||
function _ctools_entity_field_value_filter_items_by_column($items, $column) {
|
||||
$column_items = array();
|
||||
foreach ($items as $delta => $values) {
|
||||
$column_items[$delta] = isset($values[$column]) ? $values[$column] : '';
|
||||
}
|
||||
return $column_items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for access.
|
||||
*/
|
||||
function ctools_entity_field_value_ctools_access_check($conf, $context, $plugin) {
|
||||
if ((!is_object($context)) || (empty($context->data))) {
|
||||
// If the context doesn't exist -- for example, a newly added entity
|
||||
// reference is used as a pane visibility criteria -- we deny access.
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
list($parent, $entity_type, $bundle_type, $field_name) = explode(':', $plugin['name']);
|
||||
|
||||
if ($field_items = field_get_items($entity_type, $context->data, $field_name)) {
|
||||
@@ -160,16 +230,27 @@ function ctools_entity_field_value_ctools_access_check($conf, $context, $plugin)
|
||||
|
||||
// Check field value.
|
||||
foreach ($field_items as $field_value) {
|
||||
foreach ($field_value as $field_column => $value) {
|
||||
// Iterate through config values.
|
||||
foreach ($conf_value_array as $conf_value) {
|
||||
// Iterate through config values.
|
||||
foreach ($conf_value_array as $conf_value) {
|
||||
$match = FALSE;
|
||||
foreach ($field_value as $field_column => $value) {
|
||||
// Check access only for stored in config column values.
|
||||
if (isset($conf_value[$field_column]) && $value == $conf_value[$field_column]) {
|
||||
return TRUE;
|
||||
if (isset($conf_value[$field_column])) {
|
||||
if ($value == $conf_value[$field_column]) {
|
||||
$match = TRUE;
|
||||
}
|
||||
else {
|
||||
$match = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($match) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,7 +259,7 @@ function ctools_entity_field_value_ctools_access_check($conf, $context, $plugin)
|
||||
|
||||
function _ctools_entity_field_value_ctools_access_get_conf_field_values($values, $langcode = LANGUAGE_NONE) {
|
||||
if (!is_array($values) || !isset($values[$langcode])) {
|
||||
return;
|
||||
return NULL;
|
||||
}
|
||||
$conf_values = array();
|
||||
|
||||
@@ -201,41 +282,130 @@ function ctools_entity_field_value_ctools_access_summary($conf, $context, $plugi
|
||||
$entity = (object)array(
|
||||
$entity_info['entity keys']['bundle'] => $bundle_type,
|
||||
);
|
||||
$string = '';
|
||||
$keys = array();
|
||||
$values = array();
|
||||
$value_keys = array();
|
||||
$keyed_elements = array();
|
||||
foreach ($field['columns'] as $column => $attributes) {
|
||||
$conf_key = _field_sql_storage_columnname($field_name, $column);
|
||||
if (count($field['columns']) > 1) {
|
||||
// Add some sort of handling for compound fields
|
||||
}
|
||||
else {
|
||||
if (isset($conf[$conf_key])) {
|
||||
$entity->{$field_name}[LANGUAGE_NONE][] = array($column => $conf[$conf_key]);
|
||||
$keyed_elements["@{$column}_value"] = array();
|
||||
|
||||
if (isset($conf[$conf_key])) {
|
||||
if (is_array($conf[$conf_key])) {
|
||||
$i = 0;
|
||||
foreach ($conf[$conf_key] as $conf_value) {
|
||||
if (!is_array($conf_value)) {
|
||||
$entity->{$field_name}[LANGUAGE_NONE][$i][$column] = $conf_value;
|
||||
$keyed_elements["@{$column}_value"][$i] = array('#markup' => $conf_value);
|
||||
}
|
||||
elseif (isset($conf_value[$column])) {
|
||||
$entity->{$field_name}[LANGUAGE_NONE][$i][$column] = $conf_value[$column];
|
||||
$keyed_elements["@{$column}_value"][$i] = array('#markup' => $conf_value[$column]);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$entity->{$field_name}[LANGUAGE_NONE][0][$column] = $conf[$conf_key];
|
||||
$keyed_elements["@{$column}_value"][0] = array('#markup' => $conf[$conf_key]);
|
||||
}
|
||||
}
|
||||
$string .= " @{$column} equals @{$column}_value";
|
||||
$keys['@' . $column] = $column;
|
||||
$values["@{$column}_value"] = $conf[$conf_key];
|
||||
}
|
||||
$view_mode = 'full';
|
||||
$null = NULL;
|
||||
$options = array('language' => LANGUAGE_NONE);
|
||||
ctools_include('fields');
|
||||
$display = field_get_display($instance, $view_mode, $entity);
|
||||
if (isset($display['module'])) {
|
||||
$display['type'] = 'list_default';
|
||||
$function = $display['module'] . '_field_formatter_view';
|
||||
$items = isset($entity->{$field_name}[LANGUAGE_NONE]) ? $entity->{$field_name}[LANGUAGE_NONE] : array();
|
||||
if (function_exists($function)) {
|
||||
$elements = $function($entity_type, $entity, $field, $instance, LANGUAGE_NONE, $items, $display);
|
||||
}
|
||||
$value_keys = array_keys($values);
|
||||
foreach ($value_keys as $key => $value) {
|
||||
$values[$value] = isset($elements[$key]['#markup']) ? $elements[$key]['#markup'] : '';
|
||||
}
|
||||
}
|
||||
$values = array_merge($keys, $values);
|
||||
return t($string, $values);
|
||||
}
|
||||
|
||||
$keys['@' . $column] = $column;
|
||||
$value_keys[] = "@{$column}_value";
|
||||
}
|
||||
$elements = array();
|
||||
$items = isset($entity->{$field_name}[LANGUAGE_NONE]) ? $entity->{$field_name}[LANGUAGE_NONE] : array();
|
||||
$view_mode = 'full';
|
||||
ctools_include('fields');
|
||||
$display = field_get_display($instance, $view_mode, $entity);
|
||||
if (!isset($display['module'])) {
|
||||
$display['module'] = $field['module'];
|
||||
}
|
||||
if (isset($display['module'])) {
|
||||
// Choose simple formatter for well known cases.
|
||||
switch ($display['module']) {
|
||||
case 'text':
|
||||
$display['type'] = 'text_default';
|
||||
break;
|
||||
|
||||
case 'list':
|
||||
$display['type'] = 'list_default';
|
||||
if ($field['type'] == 'list_boolean') {
|
||||
$allowed_values = list_allowed_values($field, $instance, $entity_type, $entity);
|
||||
foreach ($items as $item) {
|
||||
if (isset($allowed_values[$item['value']])) {
|
||||
if ($allowed_values[$item['value']] == '') {
|
||||
$display['type'] = 'list_key';
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$display['type'] = 'list_key';
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'taxonomy':
|
||||
$display['type'] = 'taxonomy_term_reference_plain';
|
||||
break;
|
||||
|
||||
case 'entityreference':
|
||||
$display['type'] = 'entityreference_label';
|
||||
break;
|
||||
|
||||
default:
|
||||
// Use field instance formatter setting.
|
||||
break;
|
||||
}
|
||||
|
||||
$function = $display['module'] . '_field_formatter_view';
|
||||
if (function_exists($function)) {
|
||||
$entity_group = array(0 => $entity);
|
||||
$item_group = array(0 => $items);
|
||||
$instance_group = array(0 => $instance);
|
||||
field_default_prepare_view($entity_type, $entity_group, $field, $instance_group, LANGUAGE_NONE, $item_group, $display);
|
||||
$elements = $function($entity_type, $entity, $field, $instance, LANGUAGE_NONE, $item_group[0], $display);
|
||||
}
|
||||
}
|
||||
if (count($elements) > 0) {
|
||||
foreach ($field['columns'] as $column => $attributes) {
|
||||
if (count($field['columns']) == 1) {
|
||||
$keyed_elements["@{$column}_value"] = $elements;
|
||||
}
|
||||
}
|
||||
}
|
||||
$values = array();
|
||||
foreach ($value_keys as $key) {
|
||||
$output = array();
|
||||
$elements = $keyed_elements[$key];
|
||||
if (is_array($elements)) {
|
||||
foreach ($elements as $element_key => $element) {
|
||||
if (is_numeric($element_key)) {
|
||||
$value_str = strip_tags(drupal_render($element));
|
||||
if (strlen($value_str) > 0) {
|
||||
$output[] = $value_str;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$value_str = strip_tags(drupal_render($elements));
|
||||
if (strlen($value_str) > 0) {
|
||||
$output[] = $value_str;
|
||||
}
|
||||
}
|
||||
$value = implode(', ', $output);
|
||||
if ($value !== '') {
|
||||
$values[$key] = implode(', ', $output);
|
||||
}
|
||||
}
|
||||
$string = '';
|
||||
$value_count = count($values);
|
||||
foreach ($keys as $key_name => $column) {
|
||||
if (isset($values[$key_name . '_value'])) {
|
||||
$string .= ($value_count > 1) ? " @{$column} = @{$column}_value" : "@{$column}_value";
|
||||
}
|
||||
}
|
||||
return t('@field is set to "!value"', array('@field' => $instance['label'], '!value' => format_string($string, array_merge($keys, $values))));
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ $plugin = array(
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings form for the 'by parent term' access plugin
|
||||
* Settings form for the 'by parent term' access plugin.
|
||||
*/
|
||||
function ctools_front_ctools_access_settings($form, &$form_state, $conf) {
|
||||
// No additional configuration necessary.
|
||||
|
||||
@@ -24,7 +24,7 @@ $plugin = array(
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings form for the 'by node_access' access plugin
|
||||
* Settings form for the 'by node_access' access plugin.
|
||||
*/
|
||||
function ctools_node_access_ctools_access_settings($form, &$form_state, $conf) {
|
||||
$form['settings']['type'] = array(
|
||||
@@ -86,4 +86,3 @@ function ctools_node_access_ctools_access_summary($conf, $context) {
|
||||
return t('@user can create nodes of the same type as @node.', $replacement);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Plugin to provide access control based upon node comment status.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
* by the system that includes this file.
|
||||
*/
|
||||
$plugin = array(
|
||||
'title' => t("Node: comments are open"),
|
||||
'description' => t('Control access by the nodes comment status.'),
|
||||
'callback' => 'ctools_node_comment_ctools_access_check',
|
||||
'summary' => 'ctools_node_comment_ctools_access_summary',
|
||||
'required context' => new ctools_context_required(t('Node'), 'node'),
|
||||
);
|
||||
|
||||
/**
|
||||
* Checks for access.
|
||||
*/
|
||||
function ctools_node_comment_ctools_access_check($conf, $context) {
|
||||
return (!empty($context->data) && $context->data->comment == 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a summary description based upon the checked node_status.
|
||||
*/
|
||||
function ctools_node_comment_ctools_access_summary($conf, $context) {
|
||||
return t('Returns true if the nodes comment status is "open".');
|
||||
}
|
||||
@@ -23,7 +23,7 @@ if (module_exists('locale')) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings form for the 'by node_language' access plugin
|
||||
* Settings form for the 'by node_language' access plugin.
|
||||
*/
|
||||
function ctools_node_language_ctools_access_settings($form, &$form_state, $conf) {
|
||||
$options = array(
|
||||
@@ -111,4 +111,3 @@ function ctools_node_language_ctools_access_summary($conf, $context) {
|
||||
|
||||
return format_plural(count($names), '@identifier language is "@languages"', '@identifier language is one of "@languages"', array('@languages' => implode(', ', $names), '@identifier' => $context->identifier));
|
||||
}
|
||||
|
||||
|
||||
@@ -30,4 +30,3 @@ function ctools_node_status_ctools_access_check($conf, $context) {
|
||||
function ctools_node_status_ctools_access_summary($conf, $context) {
|
||||
return t('Returns true if the nodes status is "published".');
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ $plugin = array(
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings form for the 'by node_type' access plugin
|
||||
* Settings form for the 'by node_type' access plugin.
|
||||
*/
|
||||
function ctools_node_type_ctools_access_settings($form, &$form_state, $conf) {
|
||||
$types = node_type_get_types();
|
||||
@@ -114,4 +114,3 @@ function ctools_node_type_ctools_access_summary($conf, $context) {
|
||||
|
||||
return format_plural(count($names), '@identifier is type "@types"', '@identifier type is one of "@types"', array('@types' => implode(', ', $names), '@identifier' => $context->identifier));
|
||||
}
|
||||
|
||||
|
||||
@@ -11,12 +11,12 @@ $plugin = array(
|
||||
'callback' => 'ctools_path_visibility_ctools_access_check',
|
||||
'settings form' => 'ctools_path_visibility_ctools_access_settings',
|
||||
'summary' => 'ctools_path_visibility_ctools_access_summary',
|
||||
'required context' => new ctools_context_optional(t('Path'), 'string'),
|
||||
'required context' => new ctools_context_optional(t('Path'), 'string'),
|
||||
'default' => array('visibility_setting' => 1, 'paths' => ''),
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings form
|
||||
* Settings form.
|
||||
*/
|
||||
function ctools_path_visibility_ctools_access_settings($form, &$form_state, $conf) {
|
||||
$form['settings']['note'] = array(
|
||||
|
||||
@@ -20,11 +20,11 @@ $plugin = array(
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings form for the 'by perm' access plugin
|
||||
* Settings form for the 'by perm' access plugin.
|
||||
*/
|
||||
function ctools_perm_ctools_access_settings($form, &$form_state, $conf) {
|
||||
$perms = array();
|
||||
// Get list of permissions
|
||||
// Get list of permissions.
|
||||
foreach (module_list(FALSE, FALSE, TRUE) as $module) {
|
||||
// By keeping them keyed by module we can use optgroups with the
|
||||
// 'select' type.
|
||||
@@ -70,4 +70,3 @@ function ctools_perm_ctools_access_summary($conf, $context) {
|
||||
$permissions = module_invoke_all('permission');
|
||||
return t('@identifier has "@perm"', array('@identifier' => $context->identifier, '@perm' => $permissions[$conf['perm']]['title']));
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ $plugin = array(
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings form for the 'by perm' access plugin
|
||||
* Settings form for the 'by perm' access plugin.
|
||||
*
|
||||
* @todo Need a way to provide a list of all available contexts to be used by
|
||||
* the eval-ed PHP.
|
||||
@@ -38,7 +38,7 @@ function ctools_php_ctools_access_settings($form, &$form_state, $conf) {
|
||||
'#type' => 'textarea',
|
||||
'#title' => t('PHP Code'),
|
||||
'#default_value' => $conf['php'],
|
||||
'#description' => t('Access will be granted if the following PHP code returns <code>TRUE</code>. Do not include <?php ?>. Note that executing incorrect PHP-code can break your Drupal site. All contexts will be available in the <em>$contexts</em> variable.'),
|
||||
'#description' => t('Access will be granted if the following PHP code returns <code>TRUE</code>. Do not include <?php ?>. Note that executing incorrect PHP-code can break your Drupal site. All contexts will be available in the <em>$contexts</em> variable.'),
|
||||
);
|
||||
if (!user_access('use PHP for settings')) {
|
||||
$form['settings']['php']['#disabled'] = TRUE;
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Plugin for controlling access based on the existence of a query string.
|
||||
*/
|
||||
|
||||
$plugin = array(
|
||||
'title' => t('Query string exists'),
|
||||
'description' => t('Control access by whether or not a query string exists.'),
|
||||
'callback' => 'ctools_query_string_exists_ctools_access_check',
|
||||
'settings form' => 'ctools_query_string_exists_ctools_access_settings',
|
||||
'summary' => 'ctools_query_string_exists_ctools_access_summary',
|
||||
'defaults' => array('key' => ''),
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings form.
|
||||
*/
|
||||
function ctools_query_string_exists_ctools_access_settings($form, &$form_state, $config) {
|
||||
$form['settings']['key'] = array(
|
||||
'#title' => t('Query string key'),
|
||||
'#description' => t('Enter the key of the query string.'),
|
||||
'#type' => 'textfield',
|
||||
'#required' => TRUE,
|
||||
'#default_value' => $config['key'],
|
||||
);
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for access.
|
||||
*/
|
||||
function ctools_query_string_exists_ctools_access_check($config, $context) {
|
||||
return isset($_GET[$config['key']]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide a summary description.
|
||||
*/
|
||||
function ctools_query_string_exists_ctools_access_summary($config, $context) {
|
||||
return t('@identifier exists', array('@identifier' => $config['key']));
|
||||
}
|
||||
@@ -21,7 +21,7 @@ $plugin = array(
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings form for the 'by role' access plugin
|
||||
* Settings form for the 'by role' access plugin.
|
||||
*/
|
||||
function ctools_role_ctools_access_settings($form, &$form_state, $conf) {
|
||||
$form['settings']['rids'] = array(
|
||||
@@ -76,4 +76,3 @@ function ctools_role_ctools_access_summary($conf, $context) {
|
||||
|
||||
return format_plural(count($names), '@identifier has role "@roles"', '@identifier has one of "@roles"', array('@roles' => implode(', ', $names), '@identifier' => $context->identifier));
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ if (module_exists('locale')) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings form for the 'by site_language' access plugin
|
||||
* Settings form for the 'by site_language' access plugin.
|
||||
*/
|
||||
function ctools_site_language_ctools_access_settings($form, &$form_state, $conf) {
|
||||
$options = array(
|
||||
@@ -84,4 +84,3 @@ function ctools_site_language_ctools_access_summary($conf, $context) {
|
||||
|
||||
return format_plural(count($names), 'Site language is "@languages"', 'Site language is one of "@languages"', array('@languages' => implode(', ', $names)));
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Plugin to provide access control/visibility based on specified context string matching user-specified string
|
||||
* Plugin to provide access control/visibility based on specified context string matching user-specified string.
|
||||
*/
|
||||
|
||||
$plugin = array(
|
||||
@@ -16,7 +16,7 @@ $plugin = array(
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings form
|
||||
* Settings form.
|
||||
*/
|
||||
function ctools_string_equal_ctools_access_settings($form, &$form_state, $conf) {
|
||||
$form['settings']['operator'] = array(
|
||||
@@ -47,7 +47,7 @@ function ctools_string_equal_ctools_access_settings($form, &$form_state, $conf)
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for access
|
||||
* Check for access.
|
||||
*/
|
||||
function ctools_string_equal_ctools_access_check($conf, $context) {
|
||||
if (empty($context) || empty($context->data)) {
|
||||
@@ -66,29 +66,34 @@ function ctools_string_equal_ctools_access_check($conf, $context) {
|
||||
switch ($conf['operator']) {
|
||||
case '=':
|
||||
return $string === $value;
|
||||
|
||||
case '!=':
|
||||
return $string !== $value;
|
||||
|
||||
case 'regex':
|
||||
return preg_match($value, $string);
|
||||
|
||||
case '!regex':
|
||||
return !preg_match($value, $string);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide a summary description based upon the specified context
|
||||
* Provide a summary description based upon the specified context.
|
||||
*/
|
||||
function ctools_string_equal_ctools_access_summary($conf, $context) {
|
||||
$values = array('@identifier' => $context->identifier, '@value' => $conf['value']);
|
||||
switch ($conf['operator']) {
|
||||
case '=':
|
||||
return t('@identifier is "@value"', $values);
|
||||
|
||||
case '!=':
|
||||
return t('@identifier is not "@value"', $values);
|
||||
|
||||
case 'regex':
|
||||
return t('@identifier matches "@value"', $values);
|
||||
|
||||
case '!regex':
|
||||
return t('@identifier does not match "@value"', $values);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,17 +57,24 @@ function ctools_string_length_ctools_access_check($conf, $context) {
|
||||
switch ($conf['operator']) {
|
||||
case '<':
|
||||
return $length < $conf['length'];
|
||||
|
||||
case '<=':
|
||||
return $length <= $conf['length'];
|
||||
case '==':
|
||||
|
||||
case '=':
|
||||
return $length == $conf['length'];
|
||||
|
||||
case '!=':
|
||||
return $length != $conf['length'];
|
||||
|
||||
case '>':
|
||||
return $length > $conf['length'];
|
||||
|
||||
case '>=':
|
||||
return $length >= $conf['length'];
|
||||
}
|
||||
// Invalid Operator sent, return FALSE.
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,7 +22,7 @@ $plugin = array(
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings form for the 'by term' access plugin
|
||||
* Settings form for the 'by term' access plugin.
|
||||
*/
|
||||
function ctools_term_ctools_access_settings($form, &$form_state, $conf) {
|
||||
// If no configuration was saved before, set some defaults.
|
||||
@@ -51,7 +51,6 @@ function ctools_term_ctools_access_settings($form, &$form_state, $conf) {
|
||||
// A note: Dependency works strangely on these forms as they have never been
|
||||
// updated to a more modern system so they are not individual forms of their
|
||||
// own like the content types.
|
||||
|
||||
$form['settings']['#tree'] = TRUE;
|
||||
|
||||
// Loop over each of the configured vocabularies.
|
||||
@@ -124,6 +123,8 @@ function ctools_term_ctools_access_summary($conf, $context) {
|
||||
return format_plural(count($terms),
|
||||
'@term can be the term "@terms"',
|
||||
'@term can be one of these terms: @terms',
|
||||
array('@terms' => implode(', ', $terms),
|
||||
'@term' => $context->identifier));
|
||||
array(
|
||||
'@terms' => implode(', ', $terms),
|
||||
'@term' => $context->identifier,
|
||||
));
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Plugin to provide access control based upon a parent term.
|
||||
@@ -20,7 +21,7 @@ $plugin = array(
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings form for the 'by parent term' access plugin
|
||||
* Settings form for the 'by parent term' access plugin.
|
||||
*/
|
||||
function ctools_term_has_parent_ctools_access_settings($form, &$form_state, $conf) {
|
||||
// If no configuration was saved before, set some defaults.
|
||||
@@ -49,7 +50,6 @@ function ctools_term_has_parent_ctools_access_settings($form, &$form_state, $con
|
||||
// A note: Dependency works strangely on these forms as they have never been
|
||||
// updated to a more modern system so they are not individual forms of their
|
||||
// own like the content types.
|
||||
|
||||
$form['settings']['#tree'] = TRUE;
|
||||
|
||||
// Loop over each of the configured vocabularies.
|
||||
@@ -62,7 +62,7 @@ function ctools_term_has_parent_ctools_access_settings($form, &$form_state, $con
|
||||
'#default_value' => !empty($conf['vid_' . $vid]) ? $conf['vid_' . $vid] : '',
|
||||
'#size' => 10,
|
||||
'#multiple' => TRUE,
|
||||
//@todo: Remove the following workaround when the following patch is in core. {@see:http://drupal.org/node/1117526}
|
||||
// @todo: Remove the following workaround when the following patch is in core. {@see:http://drupal.org/node/1117526}
|
||||
'#name' => sprintf("settings[%u][]", $vid),
|
||||
'#attributes' => array('multiple' => 'multiple'),
|
||||
);
|
||||
@@ -71,7 +71,6 @@ function ctools_term_has_parent_ctools_access_settings($form, &$form_state, $con
|
||||
foreach (taxonomy_get_tree($vocabulary->vid) as $term) {
|
||||
$terms[$term->tid] = str_repeat('-', $term->depth) . ($term->depth ? ' ' : '') . $term->name;
|
||||
}
|
||||
//$form['settings']['vid_' . $vid]['#type'] = 'select';
|
||||
$form['settings']['vid_' . $vid]['#type'] = 'checkboxes';
|
||||
$form['settings']['vid_' . $vid]['#options'] = $terms;
|
||||
unset($terms);
|
||||
@@ -116,37 +115,36 @@ function ctools_term_has_parent_ctools_access_check($conf, $context) {
|
||||
// we'll start looking up the hierarchy from our context term id.
|
||||
$current_term = $context->data->tid;
|
||||
|
||||
$term='';
|
||||
$term = '';
|
||||
|
||||
// scan up the tree.
|
||||
while (true) {
|
||||
// select parent as term_parent to avoid PHP5 complications with the parent keyword
|
||||
//@todo: Find a way to reduce the number of queries required for really deep hierarchies.
|
||||
$term = db_query("SELECT parent AS term_parent, tid AS tid FROM {taxonomy_term_hierarchy} th WHERE th.tid = :tid", array(':tid'=>$current_term))->fetchObject();
|
||||
// Scan up the tree.
|
||||
while (TRUE) {
|
||||
// Select parent as term_parent to avoid PHP5 complications with the parent keyword.
|
||||
// @todo: Find a way to reduce the number of queries required for really deep hierarchies.
|
||||
$term = db_query("SELECT parent AS term_parent, tid AS tid FROM {taxonomy_term_hierarchy} th WHERE th.tid = :tid", array(':tid' => $current_term))->fetchObject();
|
||||
|
||||
// if no term is found, get out of the loop
|
||||
// If no term is found, get out of the loop.
|
||||
if (!$term || empty($term->tid)) {
|
||||
break;
|
||||
}
|
||||
|
||||
// check the term selected, if the user asked it to.
|
||||
// Check the term selected, if the user asked it to.
|
||||
if (!empty($conf['include_self']) && isset($conf['vid_' . $vid][$term->tid])) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// did we find the parent TID we were looking for?
|
||||
// Did we find the parent TID we were looking for?
|
||||
if (isset($conf['vid_' . $vid][$term->tid])) {
|
||||
// YES, we're done!
|
||||
return TRUE;
|
||||
}
|
||||
// Nope, we didn't find it.
|
||||
|
||||
// If this is the top of the hierarchy, stop scanning.
|
||||
if ($term->term_parent==0) {
|
||||
if ($term->term_parent == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
// update the parent, and keep scanning.
|
||||
// Update the parent, and keep scanning.
|
||||
$current_term = $term->term_parent;
|
||||
}
|
||||
|
||||
@@ -157,7 +155,7 @@ function ctools_term_has_parent_ctools_access_check($conf, $context) {
|
||||
* Provide a summary description based upon the checked terms.
|
||||
*/
|
||||
function ctools_term_has_parent_ctools_access_summary($conf, $context) {
|
||||
$vid = (int)$conf['vid'];
|
||||
$vid = (int) $conf['vid'];
|
||||
$terms = array();
|
||||
foreach ($conf['vid_' . $vid] as $tid) {
|
||||
$term = taxonomy_term_load($tid);
|
||||
@@ -167,6 +165,8 @@ function ctools_term_has_parent_ctools_access_summary($conf, $context) {
|
||||
return format_plural(count($terms),
|
||||
'@term can have the parent "@terms"',
|
||||
'@term can have one of these parents: @terms',
|
||||
array('@terms' => implode(', ', $terms),
|
||||
'@term' => $context->identifier));
|
||||
array(
|
||||
'@terms' => implode(', ', $terms),
|
||||
'@term' => $context->identifier,
|
||||
));
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ $plugin = array(
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings form for the 'by parent term' access plugin
|
||||
* Settings form for the 'by parent term' access plugin.
|
||||
*/
|
||||
function ctools_term_parent_ctools_access_settings($form, &$form_state, $conf) {
|
||||
// If no configuration was saved before, set some defaults.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Plugin to provide access control based upon term vocabulary
|
||||
* Plugin to provide access control based upon term vocabulary.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -17,25 +17,31 @@ $plugin = array(
|
||||
'settings form' => 'ctools_term_vocabulary_ctools_access_settings',
|
||||
'settings form submit' => 'ctools_term_vocabulary_ctools_access_settings_submit',
|
||||
'summary' => 'ctools_term_vocabulary_ctools_access_summary',
|
||||
'required context' => new ctools_context_required(t('Vocabulary'), array('taxonomy_term', 'terms', 'taxonomy_vocabulary')),
|
||||
'required context' => new ctools_context_required(t('Vocabulary'), array(
|
||||
'taxonomy_term',
|
||||
'terms',
|
||||
'taxonomy_vocabulary',
|
||||
)),
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings form for the 'by term_vocabulary' access plugin
|
||||
* Settings form for the 'by term_vocabulary' access plugin.
|
||||
*/
|
||||
function ctools_term_vocabulary_ctools_access_settings($form, &$form_state, $conf) {
|
||||
$options = array();
|
||||
$vocabularies = taxonomy_get_vocabularies();
|
||||
foreach ($vocabularies as $voc) {
|
||||
$options[$voc->vid] = check_plain($voc->name);
|
||||
$options[$voc->machine_name] = check_plain($voc->name);
|
||||
}
|
||||
|
||||
$form['settings']['vids'] = array(
|
||||
_ctools_term_vocabulary_ctools_access_map_vids($conf);
|
||||
|
||||
$form['settings']['machine_name'] = array(
|
||||
'#type' => 'checkboxes',
|
||||
'#title' => t('Vocabularies'),
|
||||
'#options' => $options,
|
||||
'#description' => t('Only the checked vocabularies will be valid.'),
|
||||
'#default_value' => $conf['vids'],
|
||||
'#default_value' => $conf['machine_name'],
|
||||
);
|
||||
return $form;
|
||||
}
|
||||
@@ -44,7 +50,7 @@ function ctools_term_vocabulary_ctools_access_settings($form, &$form_state, $con
|
||||
* Compress the term_vocabularys allowed to the minimum.
|
||||
*/
|
||||
function ctools_term_vocabulary_ctools_access_settings_submit($form, &$form_state) {
|
||||
$form_state['values']['settings']['vids'] = array_filter($form_state['values']['settings']['vids']);
|
||||
$form_state['values']['settings']['machine_name'] = array_filter($form_state['values']['settings']['machine_name']);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -53,11 +59,13 @@ function ctools_term_vocabulary_ctools_access_settings_submit($form, &$form_stat
|
||||
function ctools_term_vocabulary_ctools_access_check($conf, $context) {
|
||||
// As far as I know there should always be a context at this point, but this
|
||||
// is safe.
|
||||
if (empty($context) || empty($context->data) || empty($context->data->vid)) {
|
||||
if (empty($context) || empty($context->data) || empty($context->data->vocabulary_machine_name)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (array_filter($conf['vids']) && empty($conf['vids'][$context->data->vid])) {
|
||||
_ctools_term_vocabulary_ctools_access_map_vids($conf);
|
||||
|
||||
if (array_filter($conf['machine_name']) && empty($conf['machine_name'][$context->data->vocabulary_machine_name])) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -73,15 +81,45 @@ function ctools_term_vocabulary_ctools_access_summary($conf, $context) {
|
||||
}
|
||||
$vocabularies = taxonomy_get_vocabularies();
|
||||
|
||||
_ctools_term_vocabulary_ctools_access_map_vids($conf);
|
||||
|
||||
$names = array();
|
||||
foreach (array_filter($conf['vids']) as $vid) {
|
||||
$names[] = check_plain($vocabularies[$vid]->name);
|
||||
if (!empty($conf['machine_name'])) {
|
||||
foreach (array_filter($conf['machine_name']) as $machine_name) {
|
||||
foreach ($vocabularies as $vocabulary) {
|
||||
if ($vocabulary->machine_name === $machine_name) {
|
||||
$names[] = check_plain($vocabulary->name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($names)) {
|
||||
return t('@identifier is any vocabulary', array('@identifier' => $context->identifier));
|
||||
}
|
||||
|
||||
return format_plural(count($names), '@identifier vocabulary is "@vids"', '@identifier vocabulary is one of "@vids"', array('@vids' => implode(', ', $names), '@identifier' => $context->identifier));
|
||||
return format_plural(count($names), '@identifier vocabulary is "@machine_names"', '@identifier vocabulary is one of "@machine_names"', array(
|
||||
'@machine_names' => implode(', ', $names),
|
||||
'@identifier' => $context->identifier,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to map the vids from old features to the new machine_name.
|
||||
*
|
||||
* Add the machine_name key to $conf if the vids key exist.
|
||||
*
|
||||
* @param array $conf
|
||||
* The configuration of this plugin.
|
||||
*/
|
||||
function _ctools_term_vocabulary_ctools_access_map_vids(&$conf) {
|
||||
if (!empty($conf['vids'])) {
|
||||
$conf['machine_name'] = array();
|
||||
$vocabularies = taxonomy_get_vocabularies();
|
||||
foreach ($conf['vids'] as $vid) {
|
||||
$machine_name = $vocabularies[$vid]->machine_name;
|
||||
$conf['machine_name'][$machine_name] = $vocabularies[$vid]->machine_name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ $plugin = array(
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings form for the 'by theme' access plugin
|
||||
* Settings form for the 'by theme' access plugin.
|
||||
*/
|
||||
function ctools_theme_ctools_access_settings($form, &$form_state, $conf) {
|
||||
$themes = array();
|
||||
@@ -44,10 +44,10 @@ function ctools_theme_ctools_access_check($conf, $context) {
|
||||
if (!empty($GLOBALS['theme'])) {
|
||||
$theme = $GLOBALS['theme'];
|
||||
}
|
||||
else if (!empty($GLOBALS['custom_theme'])) {
|
||||
elseif (!empty($GLOBALS['custom_theme'])) {
|
||||
$theme = $GLOBALS['custom_theme'];
|
||||
}
|
||||
else if (!empty($GLOBALS['user']->theme)) {
|
||||
elseif (!empty($GLOBALS['user']->theme)) {
|
||||
$theme = $GLOBALS['user']->theme;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Plugin to provide an argument handler for all entity ids
|
||||
* Plugin to provide an argument handler for all entity ids.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -16,6 +15,10 @@ $plugin = array(
|
||||
'context' => 'ctools_argument_entity_id_context',
|
||||
'get child' => 'ctools_argument_entity_id_get_child',
|
||||
'get children' => 'ctools_argument_entity_id_get_children',
|
||||
'default' => array(
|
||||
'entity_id' => '',
|
||||
),
|
||||
'placeholder form' => 'ctools_argument_entity_id_ctools_argument_placeholder',
|
||||
);
|
||||
|
||||
function ctools_argument_entity_id_get_child($plugin, $parent, $child) {
|
||||
@@ -37,6 +40,7 @@ function ctools_argument_entity_id_get_children($original_plugin, $parent) {
|
||||
$plugins[$plugin_id] = $plugin;
|
||||
}
|
||||
drupal_alter('ctools_entity_contexts', $plugins);
|
||||
|
||||
return $plugins;
|
||||
}
|
||||
|
||||
@@ -56,15 +60,87 @@ function ctools_argument_entity_id_context($arg = NULL, $conf = NULL, $empty = F
|
||||
return ctools_context_create('entity:' . $entity_type, $arg);
|
||||
}
|
||||
|
||||
// Trim spaces and other garbage.
|
||||
$arg = trim($arg);
|
||||
|
||||
if (!is_numeric($arg)) {
|
||||
$preg_matches = array();
|
||||
$match = preg_match('/\[id: (\d+)\]/', $arg, $preg_matches);
|
||||
if (!$match) {
|
||||
$match = preg_match('/^id: (\d+)/', $arg, $preg_matches);
|
||||
}
|
||||
|
||||
if ($match) {
|
||||
$id = $preg_matches[1];
|
||||
}
|
||||
if (isset($id) && is_numeric($id)) {
|
||||
return ctools_context_create('entity:' . $entity_type, $id);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$entity = entity_load($entity_type, array($arg));
|
||||
if (!$entity) {
|
||||
$entities = entity_load($entity_type, array($arg));
|
||||
if (empty($entities)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return ctools_context_create('entity:' . $entity_type, $entity[$arg]);
|
||||
return ctools_context_create('entity:' . $entity_type, reset($entities));
|
||||
}
|
||||
|
||||
function ctools_argument_entity_id_settings_form(&$form, &$form_state, $conf) {
|
||||
$plugin = &$form_state['plugin'];
|
||||
|
||||
$form['settings']['entity'] = array(
|
||||
'#title' => t('Enter the title or ID of a @entity entity', array('@entity' => $plugin['keyword'])),
|
||||
'#type' => 'textfield',
|
||||
'#maxlength' => 512,
|
||||
'#autocomplete_path' => 'ctools/autocomplete/' . $plugin['keyword'],
|
||||
'#weight' => -10,
|
||||
);
|
||||
|
||||
if (!empty($conf['entity_id'])) {
|
||||
$info = entity_load($plugin['keyword'], array($conf['entity_id']));
|
||||
$info = $info[$conf['entity_id']];
|
||||
if ($info) {
|
||||
$entity = entity_get_info($plugin['keyword']);
|
||||
$uri = entity_uri($plugin['keyword'], $info);
|
||||
if (is_array($uri) && $entity['entity keys']['label']) {
|
||||
$link = l(t("'%title' [%type id %id]", array('%title' => $info->{$entity['entity keys']['label']}, '%type' => $plugin['keyword'], '%id' => $conf['entity_id'])), $uri['path'], array('attributes' => array('target' => '_blank', 'title' => t('Open in new window')), 'html' => TRUE));
|
||||
}
|
||||
elseif (is_array($uri)) {
|
||||
$link = l(t("[%type id %id]", array('%type' => $plugin['keyword'], '%id' => $conf['entity_id'])), $uri['path'], array('attributes' => array('target' => '_blank', 'title' => t('Open in new window')), 'html' => TRUE));
|
||||
}
|
||||
elseif ($entity['entity keys']['label']) {
|
||||
$link = l(t("'%title' [%type id %id]", array('%title' => $info->{$entity['entity keys']['label']}, '%type' => $plugin['keyword'], '%id' => $conf['entity_id'])), file_create_url($uri), array('attributes' => array('target' => '_blank', 'title' => t('Open in new window')), 'html' => TRUE));
|
||||
}
|
||||
else {
|
||||
$link = t("[%type id %id]", array('%type' => $plugin['keyword'], '%id' => $conf['entity_id']));
|
||||
}
|
||||
$form['settings']['entity']['#description'] = t('Currently set to !link', array('!link' => $link));
|
||||
}
|
||||
}
|
||||
|
||||
$form['settings']['entity_id'] = array(
|
||||
'#type' => 'value',
|
||||
'#value' => isset($conf['entity_id']) ? $conf['entity_id'] : '',
|
||||
);
|
||||
|
||||
$form['settings']['entity_type'] = array(
|
||||
'#type' => 'value',
|
||||
'#value' => $plugin['keyword'],
|
||||
);
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
function ctools_argument_entity_id_ctools_argument_placeholder($conf) {
|
||||
$conf = array(
|
||||
'#title' => t('Enter the title or ID of a @entity entity', array('@entity' => $conf['keyword'])),
|
||||
'#type' => 'textfield',
|
||||
'#maxlength' => 512,
|
||||
'#autocomplete_path' => 'ctools/autocomplete/' . $conf['keyword'],
|
||||
'#weight' => -10,
|
||||
);
|
||||
|
||||
return $conf;
|
||||
}
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Plugin to provide an argument handler for a node id
|
||||
* Plugin to provide an argument handler for a node id.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -47,4 +46,3 @@ function ctools_argument_nid_context($arg = NULL, $conf = NULL, $empty = FALSE)
|
||||
|
||||
return ctools_context_create('node', $node);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Plugin to provide an argument handler for a Node add form
|
||||
* Plugin to provide an argument handler for a Node add form.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -12,7 +11,7 @@
|
||||
*/
|
||||
$plugin = array(
|
||||
'title' => t("Node add form: node type"),
|
||||
// keyword to use for %substitution
|
||||
// Keyword to use for %substitution.
|
||||
'keyword' => 'node_type',
|
||||
'description' => t('Creates a node add form context from a node type argument.'),
|
||||
'context' => 'ctools_node_add_context',
|
||||
@@ -29,4 +28,3 @@ function ctools_node_add_context($arg = NULL, $conf = NULL, $empty = FALSE) {
|
||||
|
||||
return ctools_context_create('node_add_form', $arg);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Plugin to provide an argument handler for a Node edit form
|
||||
* Plugin to provide an argument handler for a Node edit form.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -12,7 +11,7 @@
|
||||
*/
|
||||
$plugin = array(
|
||||
'title' => t("Node edit form: node ID"),
|
||||
// keyword to use for %substitution
|
||||
// Keyword to use for %substitution.
|
||||
'keyword' => 'node',
|
||||
'description' => t('Creates a node edit form context from a node ID argument.'),
|
||||
'context' => 'ctools_node_edit_context',
|
||||
@@ -48,4 +47,3 @@ function ctools_node_edit_context($arg = NULL, $conf = NULL, $empty = FALSE) {
|
||||
// This will perform a node_access check, so we don't have to.
|
||||
return ctools_context_create('node_edit_form', $node);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Plugin to provide an argument handler for a node revision id
|
||||
* Plugin to provide an argument handler for a node revision id.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -39,7 +38,7 @@ function ctools_argument_rid_context($arg = NULL, $conf = NULL, $empty = FALSE)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$nid = db_query('SELECT nid FROM {node_revisions} WHERE vid = :vid', array(':vid' => $arg))->fetchField();
|
||||
$nid = db_query('SELECT nid FROM {node_revision} WHERE vid = :vid', array(':vid' => $arg))->fetchField();
|
||||
$node = node_load($nid, $arg);
|
||||
if (!$node) {
|
||||
return FALSE;
|
||||
@@ -47,4 +46,3 @@ function ctools_argument_rid_context($arg = NULL, $conf = NULL, $empty = FALSE)
|
||||
|
||||
return ctools_context_create('node', $node);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Plugin to provide an argument handler for a raw string
|
||||
* Plugin to provide an argument handler for a raw string.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
* by the system that includes this file.
|
||||
*/
|
||||
$plugin = array(
|
||||
'title' => t("String"),
|
||||
// keyword to use for %substitution
|
||||
// Keyword to use for %substitution.
|
||||
'keyword' => 'string',
|
||||
'description' => t('A string is a minimal context that simply holds a string that can be used for some other purpose.'),
|
||||
'settings form' => 'ctools_string_settings_form',
|
||||
@@ -20,7 +20,8 @@ $plugin = array(
|
||||
'#type' => 'textfield',
|
||||
'#description' => t('Enter a value for this argument'),
|
||||
),
|
||||
'path placeholder' => 'ctools_string_path_placeholder', // This is in pagemanager.
|
||||
// This is in pagemanager.
|
||||
'path placeholder' => 'ctools_string_path_placeholder',
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -39,7 +40,7 @@ function ctools_string_context($arg = NULL, $conf = NULL, $empty = FALSE) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings form for the argument
|
||||
* Settings form for the argument.
|
||||
*/
|
||||
function ctools_string_settings_form(&$form, &$form_state, $conf) {
|
||||
$form['settings']['use_tail'] = array(
|
||||
@@ -48,7 +49,6 @@ function ctools_string_settings_form(&$form, &$form_state, $conf) {
|
||||
'#default_value' => !empty($conf['use_tail']),
|
||||
'#description' => t('If checked, this string will include all arguments. For example, if the path is "path/%" and the user visits "path/foo/bar", if this is not checked the string will be "foo". If it is checked the string will be "foo/bar".'),
|
||||
);
|
||||
// return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,4 +61,4 @@ function ctools_string_path_placeholder($argument) {
|
||||
else {
|
||||
return '%pm_arg_tail';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Plugin to provide an argument handler for a Taxonomy term
|
||||
* Plugin to provide an argument handler for a Taxonomy term.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -12,12 +11,13 @@
|
||||
*/
|
||||
$plugin = array(
|
||||
'title' => t("Taxonomy term: ID"),
|
||||
// keyword to use for %substitution
|
||||
// Keyword to use for %substitution.
|
||||
'keyword' => 'term',
|
||||
'description' => t('Creates a single taxonomy term from a taxonomy ID or taxonomy term name.'),
|
||||
'context' => 'ctools_term_context',
|
||||
'default' => array('input_form' => 'tid', 'breadcrumb' => TRUE, 'transform' => FALSE),
|
||||
'settings form' => 'ctools_term_settings_form',
|
||||
'settings form validate' => 'ctools_term_settings_form_validate',
|
||||
'placeholder form' => 'ctools_term_ctools_argument_placeholder',
|
||||
'breadcrumb' => 'ctools_term_breadcrumb',
|
||||
);
|
||||
@@ -31,6 +31,16 @@ function ctools_term_context($arg = NULL, $conf = NULL, $empty = FALSE) {
|
||||
return ctools_context_create_empty('entity:taxonomy_term');
|
||||
}
|
||||
|
||||
if (isset($conf['vocabularies'])) {
|
||||
$vocabularies = $conf['vocabularies'];
|
||||
}
|
||||
else {
|
||||
$vids = isset($conf['vids']) ? $conf['vids'] : array();
|
||||
|
||||
// Convert legacy use of vids to machine names.
|
||||
$vocabularies = _ctools_term_vocabulary_machine_name_convert($vids);
|
||||
}
|
||||
|
||||
if (is_object($arg)) {
|
||||
$term = $arg;
|
||||
}
|
||||
@@ -50,14 +60,13 @@ function ctools_term_context($arg = NULL, $conf = NULL, $empty = FALSE) {
|
||||
}
|
||||
|
||||
$terms = taxonomy_get_term_by_name($arg);
|
||||
|
||||
$conf['vids'] = is_array($conf['vids']) ? array_filter($conf['vids']) : NULL;
|
||||
if ((count($terms) > 1) && isset($conf['vids'])) {
|
||||
// If only one term is found, fall through to vocabulary check below.
|
||||
if ((count($terms) > 1) && $vocabularies) {
|
||||
foreach ($terms as $potential) {
|
||||
foreach ($conf['vids'] as $vid => $active) {
|
||||
if ($active && $potential->vid == $vid) {
|
||||
foreach ($vocabularies as $machine_name) {
|
||||
if ($potential->vocabulary_machine_name == $machine_name) {
|
||||
$term = $potential;
|
||||
// break out of the foreaches AND the case
|
||||
// Break out of the foreaches AND the case.
|
||||
break 3;
|
||||
}
|
||||
}
|
||||
@@ -72,7 +81,7 @@ function ctools_term_context($arg = NULL, $conf = NULL, $empty = FALSE) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($conf['vids']) && array_filter($conf['vids']) && empty($conf['vids'][$term->vid])) {
|
||||
if ($vocabularies && !isset($vocabularies[$term->vocabulary_machine_name])) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -82,7 +91,7 @@ function ctools_term_context($arg = NULL, $conf = NULL, $empty = FALSE) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings form for the argument
|
||||
* Settings form for the argument.
|
||||
*/
|
||||
function ctools_term_settings_form(&$form, &$form_state, $conf) {
|
||||
// @todo allow synonym use like Views does.
|
||||
@@ -98,13 +107,20 @@ function ctools_term_settings_form(&$form, &$form_state, $conf) {
|
||||
$vocabularies = taxonomy_get_vocabularies();
|
||||
$options = array();
|
||||
foreach ($vocabularies as $vid => $vocab) {
|
||||
$options[$vid] = $vocab->name;
|
||||
$options[$vocab->machine_name] = $vocab->name;
|
||||
}
|
||||
$form['settings']['vids'] = array(
|
||||
|
||||
// Fallback on legacy 'vids', when no vocabularies are available.
|
||||
if (empty($conf['vocabularies']) && !empty($conf['vids'])) {
|
||||
$conf['vocabularies'] = _ctools_term_vocabulary_machine_name_convert(array_filter($conf['vids']));
|
||||
unset($conf['vids']);
|
||||
}
|
||||
|
||||
$form['settings']['vocabularies'] = array(
|
||||
'#title' => t('Limit to these vocabularies'),
|
||||
'#type' => 'checkboxes',
|
||||
'#options' => $options,
|
||||
'#default_value' => !empty($conf['vids']) ? $conf['vids'] : array(),
|
||||
'#default_value' => !empty($conf['vocabularies']) ? $conf['vocabularies'] : array(),
|
||||
'#description' => t('If no vocabularies are checked, terms from all vocabularies will be accepted.'),
|
||||
);
|
||||
|
||||
@@ -120,7 +136,12 @@ function ctools_term_settings_form(&$form, &$form_state, $conf) {
|
||||
'#type' => 'checkbox',
|
||||
'#default_value' => !empty($conf['transform']),
|
||||
);
|
||||
// return $form;
|
||||
}
|
||||
|
||||
function ctools_term_settings_form_validate(&$form, &$form_state) {
|
||||
// Filter the selected vocabularies to avoid storing redundant data.
|
||||
$vocabularies = array_filter($form_state['values']['settings']['vocabularies']);
|
||||
form_set_value($form['settings']['vocabularies'], $vocabularies, $form_state);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -134,6 +155,7 @@ function ctools_term_ctools_argument_placeholder($conf) {
|
||||
'#type' => 'textfield',
|
||||
'#description' => t('Enter a taxonomy term ID.'),
|
||||
);
|
||||
|
||||
case 'term':
|
||||
return array(
|
||||
'#type' => 'textfield',
|
||||
@@ -161,3 +183,21 @@ function ctools_term_breadcrumb($conf, $context) {
|
||||
$breadcrumb = array_merge(drupal_get_breadcrumb(), array_reverse($breadcrumb));
|
||||
drupal_set_breadcrumb($breadcrumb);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to convert convert legacy vocabulary ids into machine names.
|
||||
*
|
||||
* @param array $vids
|
||||
* Array of either vids.
|
||||
*
|
||||
* @return array
|
||||
* A keyed array of machine names.
|
||||
*/
|
||||
function _ctools_term_vocabulary_machine_name_convert($vids) {
|
||||
$vocabularies = taxonomy_vocabulary_load_multiple($vids);
|
||||
$return = array();
|
||||
foreach ($vocabularies as $vocabulary) {
|
||||
$return[$vocabulary->machine_name] = $vocabulary->machine_name;
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Plugin to provide an argument handler for a Taxonomy term
|
||||
* Plugin to provide an argument handler for a Taxonomy term.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -12,7 +11,7 @@
|
||||
*/
|
||||
$plugin = array(
|
||||
'title' => t("Taxonomy term (multiple): ID"),
|
||||
// keyword to use for %substitution
|
||||
// Keyword to use for %substitution.
|
||||
'keyword' => 'term',
|
||||
'description' => t('Creates a group of taxonomy terms from a list of tids separated by a comma or a plus sign. In general the first term of the list will be used for panes.'),
|
||||
'context' => 'ctools_terms_context',
|
||||
@@ -45,7 +44,7 @@ function ctools_terms_context($arg = NULL, $conf = NULL, $empty = FALSE) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings form for the argument
|
||||
* Settings form for the argument.
|
||||
*/
|
||||
function ctools_terms_settings_form(&$form, &$form_state, $conf) {
|
||||
$form['settings']['breadcrumb'] = array(
|
||||
@@ -54,7 +53,6 @@ function ctools_terms_settings_form(&$form, &$form_state, $conf) {
|
||||
'#default_value' => !empty($conf['breadcrumb']),
|
||||
'#description' => t('If checked, taxonomy term parents will appear in the breadcrumb trail.'),
|
||||
);
|
||||
// return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,6 +63,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)) {
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Plugin to provide an argument handler for a user id
|
||||
* Plugin to provide an argument handler for a user id.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -12,7 +11,7 @@
|
||||
*/
|
||||
$plugin = array(
|
||||
'title' => t("User: ID"),
|
||||
// keyword to use for %substitution
|
||||
// Keyword to use for %substitution.
|
||||
'keyword' => 'user',
|
||||
'description' => t('Creates a user context from a user ID argument.'),
|
||||
'context' => 'ctools_argument_uid_context',
|
||||
@@ -21,7 +20,8 @@ $plugin = array(
|
||||
'#description' => t('Enter the user ID of a user for this argument'),
|
||||
),
|
||||
'default' => array('to_arg' => TRUE),
|
||||
'path placeholder' => '%pm_uid_arg', // This is in pagemanager.
|
||||
// This is in pagemanager.
|
||||
'path placeholder' => '%pm_uid_arg',
|
||||
'path placeholder to_arg' => TRUE,
|
||||
'no ui' => TRUE,
|
||||
);
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Plugin to provide an argument handler for a Taxonomy term
|
||||
* Plugin to provide an argument handler for a Taxonomy term.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -12,7 +11,7 @@
|
||||
*/
|
||||
$plugin = array(
|
||||
'title' => t("User edit form: User ID"),
|
||||
// keyword to use for %substitution
|
||||
// Keyword to use for %substitution.
|
||||
'keyword' => 'user',
|
||||
'description' => t('Creates a user edit form context from a user ID argument.'),
|
||||
'context' => 'ctools_user_edit_context',
|
||||
@@ -30,18 +29,18 @@ function ctools_user_edit_context($arg = NULL, $conf = NULL, $empty = FALSE) {
|
||||
if ($empty) {
|
||||
return ctools_context_create_empty('user_edit_form');
|
||||
}
|
||||
if(is_object($arg)){
|
||||
if (is_object($arg)) {
|
||||
return ctools_context_create('user_edit_form', $arg);
|
||||
}
|
||||
if (!is_numeric($arg)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$account= user_load($arg);
|
||||
$account = user_load($arg);
|
||||
if (!$account) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// This will perform a node_access check, so we don't have to.
|
||||
return ctools_context_create('user_edit_form', $account);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Plugin to provide an argument handler for a username
|
||||
* Plugin to provide an argument handler for a username.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -12,7 +11,7 @@
|
||||
*/
|
||||
$plugin = array(
|
||||
'title' => t("User: name"),
|
||||
// keyword to use for %substitution
|
||||
// Keyword to use for %substitution.
|
||||
'keyword' => 'user',
|
||||
'description' => t('Creates a user context from a user name.'),
|
||||
'context' => 'ctools_argument_user_name_context',
|
||||
@@ -42,6 +41,3 @@ function ctools_argument_user_name_context($arg = NULL, $conf = NULL, $empty = F
|
||||
}
|
||||
return ctools_context_create('user', $account);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Plugin to provide an argument handler for a vocabulary id
|
||||
* Plugin to provide an argument handler for a vocabulary id.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -12,7 +11,7 @@
|
||||
*/
|
||||
$plugin = array(
|
||||
'title' => t("Vocabulary: ID"),
|
||||
// keyword to use for %substitution
|
||||
// Keyword to use for %substitution.
|
||||
'keyword' => 'vocabulary',
|
||||
'description' => t('Creates a vocabulary context from a vocabulary ID argument.'),
|
||||
'context' => 'ctools_vid_context',
|
||||
@@ -43,4 +42,3 @@ function ctools_vid_context($arg = NULL, $conf = NULL, $empty = FALSE) {
|
||||
|
||||
return ctools_context_create('vocabulary', $vocabulary);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* A caching mechanism for use with subsystems that use the export ui.
|
||||
*/
|
||||
|
||||
$plugin = array(
|
||||
// Cache plugins are the rare plugin types that have no real UI but
|
||||
// we're providing a title just in case.
|
||||
'title' => t('Export UI wizard cache'),
|
||||
'cache get' => 'ctools_cache_export_ui_cache_get',
|
||||
'cache set' => 'ctools_cache_export_ui_cache_set',
|
||||
// Some operations use a 'finalize' but that really just means set
|
||||
// for us, since we're not using temporary storage for subsystems.
|
||||
'cache finalize' => 'ctools_cache_export_ui_cache_set',
|
||||
);
|
||||
|
||||
function ctools_cache_export_ui_cache_get($plugin_name, $key) {
|
||||
ctools_include('export-ui');
|
||||
$plugin = ctools_get_export_ui($plugin_name);
|
||||
$handler = ctools_export_ui_get_handler($plugin);
|
||||
if ($handler) {
|
||||
$item = $handler->edit_cache_get($key);
|
||||
if (!$item) {
|
||||
$item = ctools_export_crud_load($handler->plugin['schema'], $key);
|
||||
}
|
||||
return $item;
|
||||
}
|
||||
}
|
||||
|
||||
function ctools_cache_export_ui_cache_set($plugin_name, $key, $item) {
|
||||
ctools_include('export-ui');
|
||||
$plugin = ctools_get_export_ui($plugin_name);
|
||||
$handler = ctools_export_ui_get_handler($plugin);
|
||||
if ($handler) {
|
||||
return $handler->edit_cache_set_key($item, $key);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* A simple cache indirection mechanism that just uses the basic object cache.
|
||||
*/
|
||||
|
||||
$plugin = array(
|
||||
// Cache plugins are the rare plugin types that have no real UI but
|
||||
// we're providing a title just in case.
|
||||
'title' => t('Simple'),
|
||||
'cache get' => 'ctools_cache_simple_cache_get',
|
||||
'cache set' => 'ctools_cache_simple_cache_set',
|
||||
'cache clear' => 'ctools_cache_simple_cache_clear',
|
||||
);
|
||||
|
||||
function ctools_cache_simple_cache_get($data, $key) {
|
||||
ctools_include('object-cache');
|
||||
|
||||
// Ensure that if there is somehow no data, we at least don't stomp on other
|
||||
// people's caches.
|
||||
if (empty($data)) {
|
||||
$data = 'simple_cache_plugin';
|
||||
}
|
||||
|
||||
return ctools_object_cache_get($data, $key);
|
||||
}
|
||||
|
||||
function ctools_cache_simple_cache_set($data, $key, $object) {
|
||||
ctools_include('object-cache');
|
||||
|
||||
// Ensure that if there is somehow no data, we at least don't stomp on other
|
||||
// people's caches.
|
||||
if (empty($data)) {
|
||||
$data = 'simple_cache_plugin';
|
||||
}
|
||||
|
||||
return ctools_object_cache_set($data, $key, $object);
|
||||
}
|
||||
|
||||
function ctools_cache_simple_cache_clear($data, $key) {
|
||||
ctools_include('object-cache');
|
||||
|
||||
// Ensure that if there is somehow no data, we at least don't stomp on other
|
||||
// people's caches.
|
||||
if (empty($data)) {
|
||||
$data = 'simple_cache_plugin';
|
||||
}
|
||||
|
||||
return ctools_object_cache_clear($data, $key);
|
||||
}
|
||||
@@ -40,13 +40,18 @@ 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');
|
||||
if ($module_blocks) {
|
||||
foreach ($module_blocks as $delta => $block) {
|
||||
$info = _ctools_block_content_type_content_type($module, $delta, $block);
|
||||
// this check means modules can remove their blocks; particularly useful
|
||||
// This check means modules can remove their blocks; particularly useful
|
||||
// if they offer the block some other way (like we do for views)
|
||||
if ($info) {
|
||||
$types["$module-$delta"] = $info;
|
||||
@@ -143,27 +148,32 @@ function ctools_block_content_type_render($subtype, $conf) {
|
||||
$block = module_invoke($module, 'block_view', $delta);
|
||||
|
||||
if (!empty($info)) {
|
||||
// Valid PHP function names cannot contain hyphens.
|
||||
$block_delta = str_replace('-', '_', $delta);
|
||||
|
||||
// Allow modules to modify the block before it is viewed, via either
|
||||
// hook_block_view_alter() or hook_block_view_MODULE_DELTA_alter().
|
||||
drupal_alter(array('block_view', "block_view_{$module}_{$delta}"), $block, $info);
|
||||
drupal_alter(array('block_view', "block_view_{$module}_{$block_delta}"), $block, $info);
|
||||
}
|
||||
$block = (object) $block;
|
||||
|
||||
if (empty($block)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$block = (object) $block;
|
||||
$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;
|
||||
}
|
||||
elseif (isset($block->subject)) {
|
||||
$block->title = $block->subject;
|
||||
}
|
||||
else {
|
||||
$block->title = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (module_exists('block') && user_access('administer blocks')) {
|
||||
@@ -198,70 +208,6 @@ function ctools_block_content_type_edit_form_submit($form, &$form_state) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an edit form for a block.
|
||||
*/
|
||||
//function ctools_block_content_type_edit_form($id, $parents, $conf) {
|
||||
// if (user_access('administer advanced pane settings')) {
|
||||
// $form['block_visibility'] = array(
|
||||
// '#type' => 'checkbox',
|
||||
// '#title' => t('Use block visibility settings (see block config)'),
|
||||
// '#default_value' => !empty($conf['block_visibility']),
|
||||
// '#description' => t('If checked, the block visibility settings for this block will apply to this block.'),
|
||||
// );
|
||||
// // Module-specific block configurations.
|
||||
// if ($settings = module_invoke($module, 'block', 'configure', $delta)) {
|
||||
// // Specifically modify a couple of core block forms.
|
||||
// if ($module == 'block') {
|
||||
// unset($settings['submit']);
|
||||
// $settings['info']['#type'] = 'value';
|
||||
// $settings['info']['#value'] = $settings['info']['#default_value'];
|
||||
// }
|
||||
// ctools_admin_fix_block_tree($settings);
|
||||
// $form['block_settings'] = array(
|
||||
// '#type' => 'fieldset',
|
||||
// '#title' => t('Block settings'),
|
||||
// '#description' => t('Settings in this section are global and are for all blocks of this type, anywhere in the system.'),
|
||||
// '#tree' => FALSE,
|
||||
// );
|
||||
//
|
||||
//
|
||||
// $form['block_settings'] += $settings;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return $form;
|
||||
//}
|
||||
|
||||
//function ctools_admin_submit_block(&$form_values) {
|
||||
// if (!empty($form_values['block_settings'])) {
|
||||
// module_invoke($form_values['module'], 'block', 'save', $form_values['delta'], $form_values['block_settings']);
|
||||
// }
|
||||
//}
|
||||
//
|
||||
///**
|
||||
// * Because form api cannot collapse just part of a tree, and the block settings
|
||||
// * assume no tree, we have to collapse the tree ourselves.
|
||||
// */
|
||||
//function ctools_admin_fix_block_tree(&$form, $key = NULL) {
|
||||
// if ($key) {
|
||||
// if (!empty($form['#parents'])) {
|
||||
// $form['#parents'] = array_merge(array('configuration', 'block_settings'), $form['#parents']);
|
||||
// }
|
||||
// else if (empty($form['#tree'])) {
|
||||
// $form['#parents'] = array('configuration', 'block_settings', $key);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (isset($form['#type']) && $form['#type'] == 'textarea' && !empty($form['#rows']) && $form['#rows'] > 10) {
|
||||
// $form['#rows'] = 10;
|
||||
// }
|
||||
//
|
||||
// foreach (element_children($form) as $key) {
|
||||
// ctools_admin_fix_block_tree($form[$key], $key);
|
||||
// }
|
||||
//}
|
||||
|
||||
/**
|
||||
* Returns the administrative title for a type.
|
||||
*/
|
||||
@@ -286,13 +232,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;
|
||||
}
|
||||
}
|
||||
@@ -323,8 +274,10 @@ function ctools_default_block_info($module, $delta, &$info) {
|
||||
}
|
||||
}
|
||||
|
||||
// These are all on behalf of modules that don't implement ctools but that
|
||||
// we care about.
|
||||
/**
|
||||
* These are all on behalf of modules that don't implement ctools but that
|
||||
* we care about.
|
||||
*/
|
||||
function menu_ctools_block_info($module, $delta, &$info) {
|
||||
$info['icon'] = 'icon_core_block_menu.png';
|
||||
$info['category'] = t('Menus');
|
||||
@@ -345,7 +298,7 @@ function forum_ctools_block_info($module, $delta, &$info) {
|
||||
break;
|
||||
|
||||
default:
|
||||
// safety net
|
||||
// Safety net.
|
||||
ctools_default_block_info($module, $delta, $info);
|
||||
}
|
||||
}
|
||||
@@ -357,9 +310,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) {
|
||||
@@ -440,7 +393,7 @@ function user_ctools_block_info($module, $delta, &$info) {
|
||||
break;
|
||||
|
||||
default:
|
||||
// safety net
|
||||
// Safety net.
|
||||
ctools_default_block_info($module, $delta, $info);
|
||||
}
|
||||
}
|
||||
@@ -493,7 +446,7 @@ function ctools_user_login_pane_render($subtype, $conf, $panel_args, $contexts)
|
||||
return;
|
||||
}
|
||||
|
||||
$info = new stdClass;
|
||||
$info = new stdClass();
|
||||
$info->module = $module;
|
||||
$info->delta = $delta;
|
||||
|
||||
@@ -522,7 +475,7 @@ function ctools_user_login_pane_render($subtype, $conf, $panel_args, $contexts)
|
||||
if ($module == 'block') {
|
||||
$block->title = $info->title;
|
||||
}
|
||||
else if (isset($block->subject)) {
|
||||
elseif (isset($block->subject)) {
|
||||
$block->title = $block->subject;
|
||||
}
|
||||
else {
|
||||
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* 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('Comment created date'),
|
||||
'icon' => 'icon_comment.png',
|
||||
'description' => t('The date the referenced comment was created.'),
|
||||
'required context' => new ctools_context_required(t('Comment'), 'entity:comment'),
|
||||
'category' => t('Comment'),
|
||||
'defaults' => array(
|
||||
'format' => 'small',
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Render the custom content type.
|
||||
*/
|
||||
function ctools_comment_created_content_type_render($subtype, $conf, $panel_args, $context) {
|
||||
if (empty($context) || empty($context->data)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get a shortcut to the comment.
|
||||
$comment = $context->data;
|
||||
|
||||
// Build the content type block.
|
||||
$block = new stdClass();
|
||||
$block->module = 'comment_created';
|
||||
$block->title = t('Created date');
|
||||
$block->content = format_date($comment->created, $conf['format']);
|
||||
$block->delta = $comment->cid;
|
||||
|
||||
return $block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an edit form for custom type settings.
|
||||
*/
|
||||
function ctools_comment_created_content_type_edit_form($form, &$form_state) {
|
||||
$conf = $form_state['conf'];
|
||||
$date_types = array();
|
||||
|
||||
foreach (system_get_date_types() as $date_type => $definition) {
|
||||
$date_types[$date_type] = format_date(REQUEST_TIME, $date_type);
|
||||
}
|
||||
$form['format'] = array(
|
||||
'#title' => t('Date format'),
|
||||
'#type' => 'select',
|
||||
'#options' => $date_types,
|
||||
'#default_value' => $conf['format'],
|
||||
);
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit handler for the custom type settings form.
|
||||
*/
|
||||
function ctools_comment_created_content_type_edit_form_submit($form, &$form_state) {
|
||||
// Copy everything from our defaults.
|
||||
foreach (array_keys($form_state['plugin']['defaults']) as $key) {
|
||||
$form_state['conf'][$key] = $form_state['values'][$key];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the administrative title for a type.
|
||||
*/
|
||||
function ctools_comment_created_content_type_admin_title($subtype, $conf, $context) {
|
||||
return t('"@s" created date', array('@s' => $context->identifier));
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* 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('Comment links'),
|
||||
'icon' => 'icon_comment.png',
|
||||
'description' => t('Comment links of the referenced comment.'),
|
||||
'required context' => new ctools_context_required(t('Comment'), 'entity:comment'),
|
||||
'category' => t('Comment'),
|
||||
'defaults' => array(
|
||||
'override_title' => FALSE,
|
||||
'override_title_text' => '',
|
||||
'build_mode' => '',
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Output function for the comment links.
|
||||
*/
|
||||
function ctools_comment_links_content_type_render($subtype, $conf, $panel_args, $context) {
|
||||
if (!empty($context) && empty($context->data)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$comment = isset($context->data) ? clone $context->data : NULL;
|
||||
$block = new stdClass();
|
||||
$block->module = 'comment';
|
||||
$block->delta = $comment->cid;
|
||||
|
||||
if (empty($comment)) {
|
||||
$block->delta = 'placeholder';
|
||||
$block->subject = t('Comment subject.');
|
||||
$block->content = t('Comment links go here.');
|
||||
}
|
||||
else {
|
||||
$node = node_load($comment->nid);
|
||||
$block->subject = $comment->subject;
|
||||
comment_build_content($comment, $node, $conf['build_mode']);
|
||||
$block->content = $comment->content['links'];
|
||||
}
|
||||
return $block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an edit form for the custom type.
|
||||
*/
|
||||
function ctools_comment_links_content_type_edit_form($form, &$form_state) {
|
||||
$conf = $form_state['conf'];
|
||||
|
||||
$entity = entity_get_info('comment');
|
||||
$build_mode_options = array();
|
||||
foreach ($entity['view modes'] as $mode => $option) {
|
||||
$build_mode_options[$mode] = $option['label'];
|
||||
}
|
||||
|
||||
$form['build_mode'] = array(
|
||||
'#title' => t('Build mode'),
|
||||
'#type' => 'select',
|
||||
'#description' => t('Select a build mode for this comment.'),
|
||||
'#options' => $build_mode_options,
|
||||
'#default_value' => $conf['build_mode'],
|
||||
);
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
function ctools_comment_links_content_type_edit_form_submit($form, &$form_state) {
|
||||
// Copy everything from our defaults.
|
||||
foreach (array_keys($form_state['plugin']['defaults']) as $key) {
|
||||
$form_state['conf'][$key] = $form_state['values'][$key];
|
||||
}
|
||||
}
|
||||
|
||||
function ctools_comment_links_content_type_admin_title($subtype, $conf, $context) {
|
||||
return t('"@s" links', array('@s' => $context->identifier));
|
||||
}
|
||||
+9
-7
@@ -2,7 +2,7 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Ctools content-type plugin to provide a comment-reply form (replying either
|
||||
* CTools content-type plugin to provide a comment-reply form (replying either
|
||||
* to a node or to another comment).
|
||||
*/
|
||||
|
||||
@@ -14,21 +14,23 @@ if (module_exists('comment')) {
|
||||
'icon' => 'icon_comment.png',
|
||||
'description' => t('A form to add a new comment reply.'),
|
||||
'required context' => array(
|
||||
new ctools_context_required(t('Node'), 'node'),
|
||||
new ctools_context_optional(t('Comment'), 'comment'),
|
||||
),
|
||||
new ctools_context_required(t('Node'), 'node'),
|
||||
new ctools_context_optional(t('Comment'), 'comment'),
|
||||
),
|
||||
'category' => t('Comment'),
|
||||
'render callback' => 'ctools_comment_reply_form_content_type_render',
|
||||
'defaults' => array('anon_links' => false),
|
||||
'defaults' => array('anon_links' => FALSE),
|
||||
);
|
||||
}
|
||||
|
||||
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;
|
||||
if ($comment) {
|
||||
$block->delta = $comment->cid;
|
||||
}
|
||||
$block->title = t('Add comment');
|
||||
$node = $context[0]->data;
|
||||
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
if (module_exists('contact')) {
|
||||
/**
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
@@ -22,10 +26,10 @@ function ctools_contact_content_type_render($subtype, $conf, $panel_args, $conte
|
||||
return;
|
||||
}
|
||||
// Build the content type block.
|
||||
$block = new stdClass();
|
||||
$block->module = 'contact';
|
||||
$block->delta = 'form';
|
||||
$block->title = t('Contact');
|
||||
$block = new stdClass();
|
||||
$block->module = 'contact';
|
||||
$block->delta = 'form';
|
||||
$block->title = t('Contact');
|
||||
|
||||
module_load_include('inc', 'contact', 'contact.pages');
|
||||
$block->content = drupal_get_form('contact_site_form');
|
||||
@@ -45,11 +49,6 @@ function ctools_contact_content_type_edit_form($form, &$form_state) {
|
||||
*/
|
||||
function ctools_contact_content_type_edit_form_submit($form, &$form_state) {
|
||||
// Copy everything from our defaults.
|
||||
/*
|
||||
foreach (array_keys($form_state['plugin']['defaults']) as $key) {
|
||||
$form_state['conf'][$key] = $form_state['values'][$key];
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
if (module_exists('contact')) {
|
||||
/**
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
@@ -28,10 +32,10 @@ function ctools_user_contact_content_type_render($subtype, $conf, $panel_args, $
|
||||
}
|
||||
|
||||
// Build the content type block.
|
||||
$block = new stdClass();
|
||||
$block->module = 'contact';
|
||||
$block->delta = 'form';
|
||||
$block->title = t('Contact @name', array('@name' => $context->data->name));
|
||||
$block = new stdClass();
|
||||
$block->module = 'contact';
|
||||
$block->delta = 'form';
|
||||
$block->title = t('Contact @name', array('@name' => $context->data->name));
|
||||
|
||||
module_load_include('inc', 'contact', 'contact.pages');
|
||||
$block->content = drupal_get_form('contact_personal_form', $context->data);
|
||||
@@ -51,11 +55,6 @@ function ctools_user_contact_content_type_edit_form($form, &$form_state) {
|
||||
*/
|
||||
function ctools_user_contact_content_type_edit_form_submit(&$form, &$form_state) {
|
||||
// Copy everything from our defaults.
|
||||
/*
|
||||
foreach (array_keys($form_state['plugin']['defaults']) as $key) {
|
||||
$form_state['conf'][$key] = $form_state['values'][$key];
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
$plugin = array(
|
||||
'title' => t('Custom content'),
|
||||
'no title override' => TRUE,
|
||||
'defaults' => array('admin_title' => '', 'title' => '', 'body' => '', 'format' => filter_default_format(), 'substitute' => TRUE),
|
||||
'defaults' => array('admin_title' => '', 'title' => '', 'title_heading' => 'h2', 'body' => '', 'format' => filter_default_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' => '',
|
||||
@@ -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();
|
||||
@@ -130,6 +135,7 @@ function ctools_custom_content_type_get_conf($subtype, $conf) {
|
||||
$settings = array(
|
||||
'admin_title' => t('Missing/deleted content'),
|
||||
'title' => '',
|
||||
'title_heading' => '',
|
||||
'body' => '',
|
||||
'format' => filter_default_format(),
|
||||
'substitute' => TRUE,
|
||||
@@ -172,9 +178,10 @@ function ctools_custom_content_type_render($subtype, $conf, $args, $contexts) {
|
||||
|
||||
static $delta = 0;
|
||||
|
||||
$block = new stdClass();
|
||||
$block->subtype = ++$delta;
|
||||
$block->title = filter_xss_admin($settings['title']);
|
||||
$block = new stdClass();
|
||||
$block->subtype = ++$delta;
|
||||
$block->title = filter_xss_admin($settings['title']);
|
||||
$block->title_heading = isset($settings['title_heading']) ? $settings['title_heading'] : 'h2';
|
||||
|
||||
// Add keyword substitutions if we were configured to do so.
|
||||
$content = $settings['body'];
|
||||
@@ -262,7 +269,8 @@ function ctools_custom_content_type_edit_form($form, &$form_state) {
|
||||
$form_state['settings'] = $settings;
|
||||
|
||||
if ($settings['custom_type'] == 'fixed') {
|
||||
return $form; // no form for this case.
|
||||
// No form for this case.
|
||||
return $form;
|
||||
}
|
||||
|
||||
$form['admin_title'] = array(
|
||||
@@ -272,10 +280,36 @@ function ctools_custom_content_type_edit_form($form, &$form_state) {
|
||||
'#description' => t('This title will be used administratively to identify this pane. If blank, the regular title will be used.'),
|
||||
);
|
||||
|
||||
// Copy over the title override settings for a title heading.
|
||||
$form['aligner_start'] = array(
|
||||
'#markup' => '<div class="option-text-aligner clearfix">',
|
||||
);
|
||||
|
||||
$form['title'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#default_value' => $settings['title'],
|
||||
'#title' => t('Title'),
|
||||
'#id' => 'override-title-textfield',
|
||||
);
|
||||
|
||||
$form['title_heading'] = array(
|
||||
'#type' => 'select',
|
||||
'#default_value' => isset($settings['title_heading']) ? $settings['title_heading'] : 'h2',
|
||||
'#options' => array(
|
||||
'h1' => t('h1'),
|
||||
'h2' => t('h2'),
|
||||
'h3' => t('h3'),
|
||||
'h4' => t('h4'),
|
||||
'h5' => t('h5'),
|
||||
'h6' => t('h6'),
|
||||
'div' => t('div'),
|
||||
'span' => t('span'),
|
||||
),
|
||||
'#id' => 'override-title-heading',
|
||||
);
|
||||
|
||||
$form['aligner_stop'] = array(
|
||||
'#markup' => '</div>',
|
||||
);
|
||||
|
||||
$form['body'] = array(
|
||||
@@ -286,7 +320,7 @@ function ctools_custom_content_type_edit_form($form, &$form_state) {
|
||||
);
|
||||
|
||||
if (!empty($form_state['contexts'])) {
|
||||
// Set extended description if both CCK and Token modules are enabled, notifying of unlisted keywords
|
||||
// Set extended description if both CCK and Token modules are enabled, notifying of unlisted keywords.
|
||||
if (module_exists('content') && module_exists('token')) {
|
||||
$description = t('If checked, context keywords will be substituted in this content. Note that CCK fields may be used as keywords using patterns like <em>%node:field_name-formatted</em>.');
|
||||
}
|
||||
@@ -383,7 +417,7 @@ function ctools_custom_content_type_edit_form_validate(&$form, &$form_state) {
|
||||
form_error($form['name'], t('Name is required.'));
|
||||
}
|
||||
|
||||
// Check for string identifier sanity
|
||||
// Check for string identifier sanity.
|
||||
if (!preg_match('!^[a-z0-9_]+$!', $form_state['values']['name'])) {
|
||||
form_error($form['name'], t('The name can only consist of lowercase letters, underscores, and numbers.'));
|
||||
return;
|
||||
@@ -393,7 +427,7 @@ function ctools_custom_content_type_edit_form_validate(&$form, &$form_state) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check for name collision
|
||||
// Check for name collision.
|
||||
if ($form_state['values']['name'] == 'custom' || (ctools_export_crud_load('ctools_custom_content', $form_state['values']['name']))) {
|
||||
form_error($form['name'], t('Content with this name already exists. Please choose another name or delete the existing item before creating a new one.'));
|
||||
}
|
||||
@@ -413,7 +447,7 @@ function ctools_custom_content_type_edit_form_submit($form, &$form_state) {
|
||||
}
|
||||
// If the 'reusable' checkbox was checked, we will create a new
|
||||
// custom content and give it the proper values.
|
||||
else if (!empty($form_state['values']['reusable'])) {
|
||||
elseif (!empty($form_state['values']['reusable'])) {
|
||||
$content = ctools_export_crud_new('ctools_custom_content');
|
||||
$content->name = $form_state['values']['name'];
|
||||
_ctools_custom_content_type_edit_save($content, $form_state);
|
||||
@@ -421,7 +455,6 @@ function ctools_custom_content_type_edit_form_submit($form, &$form_state) {
|
||||
}
|
||||
else {
|
||||
// Otherwise, just save values into $conf normally.
|
||||
|
||||
foreach (array_keys($form_state['plugin']['defaults']) as $key) {
|
||||
$form_state['conf'][$key] = isset($form_state['values'][$key]) ? $form_state['values'][$key] : $form_state['plugin']['defaults'][$key];
|
||||
}
|
||||
|
||||
+75
-48
@@ -34,31 +34,45 @@ function ctools_entity_field_content_type_content_types() {
|
||||
return $types;
|
||||
}
|
||||
|
||||
$cache_key = 'ctools_entity_field_content_type_content_types';
|
||||
if ($cache = cache_get($cache_key)) {
|
||||
$types = $cache->data;
|
||||
if (!empty($types)) {
|
||||
return $types;
|
||||
}
|
||||
}
|
||||
|
||||
// This will hold all the individual field 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,18 +84,20 @@ 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']);
|
||||
}
|
||||
|
||||
cache_set($cache_key, $types);
|
||||
|
||||
return $types;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the custom content type.
|
||||
*/
|
||||
* Render the custom content type.
|
||||
*/
|
||||
function ctools_entity_field_content_type_render($subtype, $conf, $panel_args, $context) {
|
||||
if (empty($context) || empty($context->data)) {
|
||||
return;
|
||||
@@ -112,6 +128,8 @@ function ctools_entity_field_content_type_render($subtype, $conf, $panel_args, $
|
||||
$field_settings = array(
|
||||
'label' => $label,
|
||||
'type' => $conf['formatter'],
|
||||
// Pass all entity field panes settings to field display settings.
|
||||
'pane_settings' => $conf,
|
||||
);
|
||||
|
||||
// Get the field output, and the title.
|
||||
@@ -119,48 +137,37 @@ function ctools_entity_field_content_type_render($subtype, $conf, $panel_args, $
|
||||
$field_settings['settings'] = $conf['formatter_settings'];
|
||||
}
|
||||
|
||||
$all_values = field_get_items($entity_type, $entity, $field_name, $language);
|
||||
if (!is_array($all_values)) {
|
||||
$all_values = array();
|
||||
}
|
||||
|
||||
// Reverse values.
|
||||
if (isset($conf['delta_reversed']) && $conf['delta_reversed']) {
|
||||
$all_values = array_reverse($all_values);
|
||||
}
|
||||
|
||||
if (isset($conf['delta_limit'])) {
|
||||
$delta_limit = $conf['delta_limit'];
|
||||
$offset = intval($conf['delta_offset']);
|
||||
$total = count($all_values);
|
||||
|
||||
if ($delta_limit == 0) {
|
||||
$delta_limit = $total - $offset;
|
||||
}
|
||||
|
||||
$new_values = array();
|
||||
for ($i = 0; $i < $delta_limit; $i++) {
|
||||
$new_delta = $offset + $i;
|
||||
|
||||
if (isset($all_values[$new_delta])) {
|
||||
$new_values[] = $all_values[$new_delta];
|
||||
}
|
||||
}
|
||||
|
||||
$all_values = $new_values;
|
||||
}
|
||||
|
||||
$clone = clone $entity;
|
||||
$clone->{$field_name}[$language] = $all_values;
|
||||
$all_values = field_get_items($entity_type, $entity, $field_name, $language);
|
||||
|
||||
if (is_array($all_values)) {
|
||||
// Reverse values.
|
||||
if (isset($conf['delta_reversed']) && $conf['delta_reversed']) {
|
||||
$all_values = array_reverse($all_values, TRUE);
|
||||
}
|
||||
|
||||
if (isset($conf['delta_limit'])) {
|
||||
$offset = intval($conf['delta_offset']);
|
||||
$limit = !empty($conf['delta_limit']) ? $conf['delta_limit'] : NULL;
|
||||
$all_values = array_slice($all_values, $offset, $limit, TRUE);
|
||||
}
|
||||
|
||||
$clone->{$field_name}[$language] = $all_values;
|
||||
}
|
||||
|
||||
$field_output = field_view_field($entity_type, $clone, $field_name, $field_settings, $language);
|
||||
|
||||
if (!empty($field_output) && !empty($conf['override_title'])) {
|
||||
$field_output['#title'] = filter_xss_admin($conf['override_title_text']);
|
||||
if (!empty($field_output)) {
|
||||
if (!empty($conf['override_title'])) {
|
||||
$field_output['#title'] = filter_xss_admin($conf['override_title_text']);
|
||||
}
|
||||
$field_output['#ctools_context'] = $context;
|
||||
$field_output['#post_render'][] = 'ctools_entity_field_content_type_substitute_keywords';
|
||||
}
|
||||
|
||||
// Build the content type block.
|
||||
$block = new stdClass();
|
||||
$block->module = 'entity_field';
|
||||
$block->module = 'entity_field';
|
||||
if ($conf['label'] == 'title' && isset($field_output['#title'])) {
|
||||
$block->title = $field_output['#title'];
|
||||
}
|
||||
@@ -172,8 +179,15 @@ function ctools_entity_field_content_type_render($subtype, $conf, $panel_args, $
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an edit form for custom type settings.
|
||||
*/
|
||||
* Replace context keywords.
|
||||
*/
|
||||
function ctools_entity_field_content_type_substitute_keywords($markup, array $element) {
|
||||
return ctools_context_keyword_substitute($markup, array(), array($element['#ctools_context']));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an edit form for custom type settings.
|
||||
*/
|
||||
function ctools_entity_field_content_type_formatter_options($form, &$form_state) {
|
||||
if (empty($form_state['conf']['formatter_settings'])) {
|
||||
$form_state['conf']['formatter_settings'] = array();
|
||||
@@ -227,6 +241,11 @@ function ctools_entity_field_content_type_formatter_styles($form, &$form_state)
|
||||
ctools_form_include($form_state, 'field_ui.admin', 'field_ui', '');
|
||||
ctools_form_include($form_state, 'fields');
|
||||
|
||||
$form['ctools_keywords'] = array(
|
||||
'#type' => 'item',
|
||||
'#description' => t('You may use keywords for substitutions.'),
|
||||
);
|
||||
|
||||
$form['ctools_field_list'] = array(
|
||||
'#type' => 'value',
|
||||
'#value' => array(),
|
||||
@@ -257,10 +276,18 @@ function ctools_entity_field_content_type_formatter_styles_submit($form, &$form_
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the administrative title for a type.
|
||||
*/
|
||||
* Returns the administrative title for a type.
|
||||
*/
|
||||
function ctools_entity_field_content_type_admin_title($subtype, $conf, $context) {
|
||||
list($bundle, $field_name) = explode(':', $subtype);
|
||||
ctools_include('fields');
|
||||
return t('"@s" @field', array('@s' => $context->identifier, '@field' => ctools_field_label($field_name)));
|
||||
if (is_object($context) && isset($context->identifier)) {
|
||||
$identifier = $context->identifier;
|
||||
}
|
||||
else {
|
||||
watchdog('ctools_entity_field_content_type_admin_title', 'Context is missing for field: @name', array('@name' => $subtype), WATCHDOG_NOTICE);
|
||||
$identifier = t('Unknown');
|
||||
}
|
||||
|
||||
return t('"@s" @field', array('@s' => $identifier, '@field' => ctools_field_label($field_name)));
|
||||
}
|
||||
|
||||
+22
-6
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
$plugin = array(
|
||||
'title' => t('Entity extra field'),
|
||||
'defaults' => array('view_mode' => NULL),
|
||||
@@ -25,6 +29,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,17 +106,24 @@ 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.
|
||||
$block = new stdClass();
|
||||
$block = new stdClass();
|
||||
$block->module = 'entity_field_extra';
|
||||
$block->content = $entity->content[$field_name];
|
||||
$block->delta = $id;
|
||||
|
||||
+62
-12
@@ -30,13 +30,21 @@ 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();
|
||||
|
||||
$field_instances = field_info_instances();
|
||||
foreach ($entities as $entity_type => $entity) {
|
||||
foreach ($entity['bundles'] as $type => $bundle) {
|
||||
foreach (field_info_instances($entity_type, $type) as $field_name => $field) {
|
||||
if (!isset($field_instances[$entity_type][$type])) {
|
||||
continue;
|
||||
}
|
||||
foreach ($field_instances[$entity_type][$type] as $field_name => $field) {
|
||||
if (!isset($types[$entity_type . ':' . $field_name])) {
|
||||
$types[$entity_type . ':' . $field_name] = array(
|
||||
'category' => t('Form'),
|
||||
@@ -52,6 +60,26 @@ function ctools_entity_form_field_content_type_content_types() {
|
||||
}
|
||||
}
|
||||
|
||||
if (module_exists('field_group')) {
|
||||
foreach ($entities as $entity_type => $entity) {
|
||||
foreach ($entity['bundles'] as $type => $bundle) {
|
||||
if ($group_info = field_group_info_groups($entity_type, $type, "form")) {
|
||||
foreach ($group_info as $group_name => $group) {
|
||||
if (!isset($types[$entity_type . ':' . $group_name])) {
|
||||
$types[$entity_type . ':' . $group_name] = array(
|
||||
'category' => t('Form'),
|
||||
'icon' => 'icon_field.png',
|
||||
'title' => t('Group form: @widget_label', array('@widget_label' => $group->label)),
|
||||
'description' => t('Field group on the referenced entity.'),
|
||||
);
|
||||
}
|
||||
$content_types[$entity_type . ':' . $group_name]['types'][$type] = $bundle['label'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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);
|
||||
@@ -65,8 +93,8 @@ function ctools_entity_form_field_content_type_content_types() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the custom content type.
|
||||
*/
|
||||
* Render the custom content type.
|
||||
*/
|
||||
function ctools_entity_form_field_content_type_render($subtype, $conf, $panel_args, $context) {
|
||||
if (empty($context) || empty($context->data)) {
|
||||
return;
|
||||
@@ -80,16 +108,38 @@ function ctools_entity_form_field_content_type_render($subtype, $conf, $panel_ar
|
||||
$ids = entity_extract_ids($entity_type, $entity);
|
||||
$field = field_info_instance($entity_type, $field_name, $ids[2]);
|
||||
|
||||
// Do not render if the entity type does not have this field.
|
||||
if (empty($field)) {
|
||||
// Check for field groups.
|
||||
if (empty($field) && module_exists('field_group')) {
|
||||
$groups = field_group_info_groups($entity_type, $entity->type, "form");
|
||||
$group = !empty($groups[$field_name]) ? $groups[$field_name] : NULL;
|
||||
}
|
||||
|
||||
// Do not render if the entity type does not have this field or group.
|
||||
if (empty($field) && empty($group)) {
|
||||
return;
|
||||
}
|
||||
$block = new stdClass();
|
||||
|
||||
$block = new stdClass();
|
||||
if (isset($context->form)) {
|
||||
$block->content = array();
|
||||
$block->content[$field_name] = $context->form[$field_name];
|
||||
unset($context->form[$field_name]);
|
||||
if (!empty($field)) {
|
||||
$block->content[$field_name] = $context->form[$field_name];
|
||||
unset($context->form[$field_name]);
|
||||
}
|
||||
else {
|
||||
// Pre-render the form to populate field groups.
|
||||
if (isset($context->form['#pre_render'])) {
|
||||
foreach ($context->form['#pre_render'] as $function) {
|
||||
if (function_exists($function)) {
|
||||
$context->form = $function($context->form);
|
||||
}
|
||||
}
|
||||
unset($context->form['#pre_render']);
|
||||
}
|
||||
|
||||
$block->content[$field_name] = $context->form[$field_name];
|
||||
unset($context->form[$field_name]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$block->content = t('Entity info.');
|
||||
@@ -99,8 +149,8 @@ function ctools_entity_form_field_content_type_render($subtype, $conf, $panel_ar
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the administrative title for a type.
|
||||
*/
|
||||
* Returns the administrative title for a type.
|
||||
*/
|
||||
function ctools_entity_form_field_content_type_admin_title($subtype, $conf, $context) {
|
||||
list($entity_type, $field_name) = explode(':', $subtype, 2);
|
||||
|
||||
@@ -115,6 +165,6 @@ function ctools_entity_form_field_content_type_admin_title($subtype, $conf, $con
|
||||
}
|
||||
|
||||
function ctools_entity_form_field_content_type_edit_form($form, &$form_state) {
|
||||
// provide a blank form so we have a place to have context setting.
|
||||
// Provide a blank form so we have a place to have context setting.
|
||||
return $form;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
* by the system that includes this file.
|
||||
*/
|
||||
|
||||
$plugin = array(
|
||||
// only provides a single content type
|
||||
// Only provides a single content type.
|
||||
'single' => TRUE,
|
||||
'render last' => TRUE,
|
||||
'title' => t('General form'),
|
||||
@@ -43,7 +45,7 @@ function ctools_form_content_type_render($subtype, $conf, $panel_args, &$context
|
||||
$block->delta = $context->form_id;
|
||||
}
|
||||
else {
|
||||
$block->title = t('Form');
|
||||
$block->title = t('Form');
|
||||
$block->content = t('Form goes here.');
|
||||
$block->delta = 'unknown';
|
||||
}
|
||||
@@ -56,7 +58,7 @@ function ctools_form_content_type_admin_title($subtype, $conf, $context) {
|
||||
}
|
||||
|
||||
function ctools_form_content_type_edit_form($form, &$form_state) {
|
||||
// provide a blank form so we have a place to override title
|
||||
// Provide a blank form so we have a place to override title
|
||||
// and stuff.
|
||||
return $form;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
* by the system that includes this file.
|
||||
*/
|
||||
$plugin = array(
|
||||
'title' => t('Node'),
|
||||
'title' => t('Existing node'),
|
||||
'single' => TRUE,
|
||||
'defaults' => array(
|
||||
'nid' => '',
|
||||
@@ -20,7 +20,6 @@ $plugin = array(
|
||||
'identifier' => '',
|
||||
'build_mode' => 'teaser',
|
||||
),
|
||||
'title' => t('Existing node'),
|
||||
'icon' => 'icon_node.png',
|
||||
'description' => t('Add a node from your site as content.'),
|
||||
'category' => t('Custom'),
|
||||
@@ -47,10 +46,10 @@ function ctools_node_content_type_render($subtype, $conf, $panel_args) {
|
||||
}
|
||||
}
|
||||
|
||||
// Support node translation
|
||||
// Support node translation.
|
||||
if (module_exists('translation')) {
|
||||
if ($translations = module_invoke('translation', 'node_get_translations', $nid)) {
|
||||
if (isset($translations[$GLOBALS['language']->language])) {
|
||||
if (isset($translations[$GLOBALS['language']->language])) {
|
||||
$nid = $translations[$GLOBALS['language']->language]->nid;
|
||||
}
|
||||
}
|
||||
@@ -67,7 +66,7 @@ function ctools_node_content_type_render($subtype, $conf, $panel_args) {
|
||||
|
||||
// Don't store viewed node data on the node, this can mess up other
|
||||
// views of the node.
|
||||
$node = clone($node);
|
||||
$node = clone $node;
|
||||
|
||||
$block->module = 'node';
|
||||
$block->delta = $node->nid;
|
||||
@@ -122,7 +121,6 @@ function ctools_node_content_type_edit_form($form, &$form_state) {
|
||||
'#description' => t('Check this box if you would like your pane title to link to the node.'),
|
||||
);
|
||||
|
||||
|
||||
if ($form_state['op'] == 'add') {
|
||||
$form['nid'] = array(
|
||||
'#prefix' => '<div class="no-float">',
|
||||
@@ -180,7 +178,7 @@ function ctools_node_content_type_edit_form($form, &$form_state) {
|
||||
/**
|
||||
* Validate the node selection.
|
||||
*/
|
||||
function ctools_node_content_type_edit_form_validate(&$form, &$form_state) {
|
||||
function ctools_node_content_type_edit_form_validate(&$form, &$form_state) {
|
||||
if ($form_state['op'] != 'add') {
|
||||
return;
|
||||
}
|
||||
@@ -206,7 +204,7 @@ function ctools_node_content_type_edit_form_validate(&$form, &$form_state) {
|
||||
}
|
||||
|
||||
if (!($node || preg_match('/^[@%]\d+$/', $nid)) ||
|
||||
// Do not allow unpublished nodes to be selected by unprivileged users
|
||||
// Do not allow unpublished nodes to be selected by unprivileged users.
|
||||
(empty($node->status) && !user_access('administer nodes'))) {
|
||||
form_error($form['nid'], t('Invalid node'));
|
||||
}
|
||||
|
||||
+4
-3
@@ -1,9 +1,11 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* 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('Attached files'),
|
||||
@@ -14,7 +16,7 @@ $plugin = array(
|
||||
);
|
||||
|
||||
function ctools_node_attachments_content_type_render($subtype, $conf, $panel_args, $context) {
|
||||
$node = isset($context->data) ? clone($context->data) : NULL;
|
||||
$node = isset($context->data) ? clone $context->data : NULL;
|
||||
$block = new stdClass();
|
||||
$block->module = 'attachments';
|
||||
|
||||
@@ -38,7 +40,6 @@ function ctools_node_attachments_content_type_admin_title($subtype, $conf, $cont
|
||||
}
|
||||
|
||||
function ctools_node_attachments_content_type_edit_form($form, &$form_state) {
|
||||
// provide a blank form so we have a place to have context setting.
|
||||
// Provide a blank form so we have a place to have context setting.
|
||||
return $form;
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -1,9 +1,11 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* 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('Node author'),
|
||||
@@ -29,7 +31,7 @@ function ctools_node_author_content_type_render($subtype, $conf, $panel_args, $c
|
||||
$user = user_load($node->uid);
|
||||
|
||||
// Build the content type block.
|
||||
$block = new stdClass();
|
||||
$block = new stdClass();
|
||||
$block->module = 'node_author';
|
||||
$block->title = t('Author');
|
||||
$block->content = !empty($conf['link']) ? theme('username', array('account' => $user, 'link_path' => 'user/' . $node->uid)) : check_plain(format_username($node));
|
||||
|
||||
+3
-1
@@ -1,9 +1,11 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* 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('Node body'),
|
||||
@@ -28,7 +30,7 @@ function ctools_node_body_content_type_render($subtype, $conf, $panel_args, $con
|
||||
* Returns an edit form for custom type settings.
|
||||
*/
|
||||
function ctools_node_body_content_type_edit_form($form, &$form_state) {
|
||||
// provide a blank form so we have a place to have context setting.
|
||||
// Provide a blank form so we have a place to have context setting.
|
||||
return $form;
|
||||
}
|
||||
|
||||
|
||||
+6
-2
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
if (module_exists('book')) {
|
||||
/**
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
@@ -16,7 +20,7 @@ if (module_exists('book')) {
|
||||
}
|
||||
|
||||
function ctools_node_book_children_content_type_render($subtype, $conf, $panel_args, $context) {
|
||||
$node = isset($context->data) ? clone($context->data) : NULL;
|
||||
$node = isset($context->data) ? clone $context->data : NULL;
|
||||
$block = new stdClass();
|
||||
$block->module = 'book_children';
|
||||
|
||||
@@ -38,6 +42,6 @@ function ctools_node_book_children_content_type_admin_title($subtype, $conf, $co
|
||||
}
|
||||
|
||||
function ctools_node_book_children_content_type_edit_form($form, &$form_state) {
|
||||
// provide a blank form so we have a place to have context setting.
|
||||
// Provide a blank form so we have a place to have context setting.
|
||||
return $form;
|
||||
}
|
||||
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
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' => drupal_get_path('module', 'ctools') . '/plugins/content_types/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;
|
||||
}
|
||||
+12
-8
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
if (module_exists('book')) {
|
||||
/**
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
@@ -7,26 +11,26 @@ 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' => drupal_get_path('module', 'ctools') . '/plugins/content_types/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'),
|
||||
);
|
||||
}
|
||||
|
||||
function ctools_node_book_nav_content_type_render($subtype, $conf, $panel_args, $context) {
|
||||
$node = isset($context->data) ? clone($context->data) : NULL;
|
||||
$node = isset($context->data) ? clone $context->data : NULL;
|
||||
$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,10 +38,10 @@ 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) {
|
||||
// provide a blank form so we have a place to have context setting.
|
||||
// Provide a blank form so we have a place to have context setting.
|
||||
return $form;
|
||||
}
|
||||
|
||||
+11
-26
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
if (module_exists('comment')) {
|
||||
/**
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
@@ -17,17 +21,16 @@ if (module_exists('comment')) {
|
||||
}
|
||||
|
||||
function ctools_node_comment_form_content_type_render($subtype, $conf, $panel_args, $context) {
|
||||
$node = isset($context->data) ? clone($context->data) : NULL;
|
||||
if (empty($context->data->nid)) {
|
||||
return;
|
||||
}
|
||||
$node = clone $context->data;
|
||||
$block = new stdClass();
|
||||
$block->module = 'comments';
|
||||
$block->delta = $node->nid;
|
||||
|
||||
$block->delta = $node->nid;
|
||||
$block->title = t('Add comment');
|
||||
|
||||
if (empty($node)) {
|
||||
$block->content = t('Comment form here.');
|
||||
}
|
||||
else if ($node->comment == COMMENT_NODE_OPEN) {
|
||||
if ($node->comment == COMMENT_NODE_OPEN) {
|
||||
if (user_access('post comments')) {
|
||||
$comment = new stdClass();
|
||||
$comment->nid = $node->nid;
|
||||
@@ -43,7 +46,7 @@ function ctools_node_comment_form_content_type_render($subtype, $conf, $panel_ar
|
||||
);
|
||||
$block->content = drupal_build_form('comment_node_' . $node->type . '_form', $form_state);
|
||||
}
|
||||
else if (!empty($conf['anon_links'])) {
|
||||
elseif (!empty($conf['anon_links'])) {
|
||||
$block->content = theme('comment_post_forbidden', array('node' => $node));
|
||||
}
|
||||
}
|
||||
@@ -76,21 +79,3 @@ function ctools_node_comment_form_content_type_edit_form_submit($form, &$form_st
|
||||
$form_state['conf'][$key] = $form_state['values'][$key];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Alter the comment form to get a little more control over it.
|
||||
*/
|
||||
function ctools_form_comment_form_alter(&$form, &$form_state) {
|
||||
if (!empty($form_state['ctools comment alter'])) {
|
||||
// Force the form to post back to wherever we are.
|
||||
$form['#action'] = url($_GET['q'], array('fragment' => 'comment-form'));
|
||||
if (empty($form['#submit'])) {
|
||||
$form['#submit'] = array('comment_form_submit');
|
||||
}
|
||||
$form['#submit'][] = 'ctools_node_comment_form_submit';
|
||||
}
|
||||
}
|
||||
|
||||
function ctools_node_comment_form_submit(&$form, &$form_state) {
|
||||
$form_state['redirect'][0] = $_GET['q'];
|
||||
}
|
||||
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
if (module_exists('comment')) {
|
||||
/**
|
||||
* 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('Comments and comment form.'),
|
||||
'icon' => 'icon_node.png',
|
||||
'description' => t('The comments and comment form for the referenced node.'),
|
||||
'required context' => new ctools_context_required(t('Node'), 'node'),
|
||||
'category' => t('Node'),
|
||||
'defaults' => array(
|
||||
'mode' => variable_get('comment_default_mode', COMMENT_MODE_THREADED),
|
||||
'comments_per_page' => variable_get('comment_default_per_page', '50'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the node comments.
|
||||
*/
|
||||
function ctools_node_comment_wrapper_content_type_render($subtype, $conf, $panel_args, $context) {
|
||||
$node = isset($context->data) ? clone $context->data : NULL;
|
||||
$block = new stdClass();
|
||||
$block->module = 'comments';
|
||||
$block->delta = $node->nid;
|
||||
|
||||
$renderable = array(
|
||||
'#theme' => 'comment_wrapper__node_' . $node->type,
|
||||
'#node' => $node,
|
||||
'comments' => array(),
|
||||
'comment_form' => array(),
|
||||
);
|
||||
|
||||
// Add in the comments.
|
||||
if (($node->comment_count && user_access('access comments')) || user_access('administer comments')) {
|
||||
$mode = variable_get('comment_default_mode_' . $node->type, COMMENT_MODE_THREADED);
|
||||
$comments_per_page = variable_get('comment_default_per_page_' . $node->type, 50);
|
||||
if ($cids = comment_get_thread($node, $mode, $comments_per_page)) {
|
||||
$comments = comment_load_multiple($cids);
|
||||
comment_prepare_thread($comments);
|
||||
$build = comment_view_multiple($comments, $node);
|
||||
$build['pager']['#theme'] = 'pager';
|
||||
$renderable['comments'] = $build;
|
||||
}
|
||||
}
|
||||
|
||||
// Stuff in the comment form.
|
||||
if ($node->comment == COMMENT_NODE_OPEN) {
|
||||
if (user_access('post comments')) {
|
||||
$comment = new stdClass();
|
||||
$comment->nid = $node->nid;
|
||||
$comment->pid = NULL;
|
||||
$form_state = array(
|
||||
'ctools comment alter' => TRUE,
|
||||
'node' => $node,
|
||||
'build_info' => array(
|
||||
'args' => array(
|
||||
$comment,
|
||||
),
|
||||
),
|
||||
);
|
||||
$renderable['comment_form'] = drupal_build_form('comment_node_' . $node->type . '_form', $form_state);
|
||||
}
|
||||
elseif (!empty($conf['anon_links'])) {
|
||||
$renderable['comment_form'] = theme('comment_post_forbidden', array('node' => $node));
|
||||
}
|
||||
}
|
||||
|
||||
$block->content = drupal_render($renderable);
|
||||
|
||||
return $block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an edit form for the comment wrapper.
|
||||
*/
|
||||
function ctools_node_comment_wrapper_content_type_edit_form($form, &$form_state) {
|
||||
$conf = $form_state['conf'];
|
||||
$form['mode'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Mode'),
|
||||
'#default_value' => $conf['mode'],
|
||||
'#options' => _comment_get_modes(),
|
||||
'#weight' => 1,
|
||||
);
|
||||
foreach (_comment_per_page() as $i) {
|
||||
$options[$i] = t('!a comments per page', array('!a' => $i));
|
||||
}
|
||||
$form['comments_per_page'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Pager'),
|
||||
'#default_value' => $conf['comments_per_page'],
|
||||
'#options' => $options,
|
||||
'#weight' => 3,
|
||||
);
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit handler for the comment wrapper settings form.
|
||||
*/
|
||||
function ctools_node_comment_wrapper_content_type_edit_form_submit($form, &$form_state) {
|
||||
// Copy everything from our defaults.
|
||||
foreach (array_keys($form_state['plugin']['defaults']) as $key) {
|
||||
$form_state['conf'][$key] = $form_state['values'][$key];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the administrative title.
|
||||
*/
|
||||
function ctools_node_comment_wrapper_content_type_admin_title($subtype, $conf, $context) {
|
||||
return t('Comments and comment form');
|
||||
}
|
||||
+13
-10
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
if (module_exists('comment')) {
|
||||
/**
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
@@ -20,19 +24,17 @@ if (module_exists('comment')) {
|
||||
}
|
||||
|
||||
function ctools_node_comments_content_type_render($subtype, $conf, $panel_args, $context) {
|
||||
$node = isset($context->data) ? clone($context->data) : NULL;
|
||||
if (empty($context->data->nid)) {
|
||||
return;
|
||||
}
|
||||
$node = clone $context->data;
|
||||
$block = new stdClass();
|
||||
$block->module = 'comments';
|
||||
$block->delta = $node->nid;
|
||||
|
||||
$block->delta = $node->nid;
|
||||
$block->title = t('Comments');
|
||||
if (empty($node)) {
|
||||
$block->content = t('Node comments go here.');
|
||||
}
|
||||
else if ($node->comment) {
|
||||
|
||||
if ($node->comment) {
|
||||
$block->content = ctools_comment_render($node, $conf);
|
||||
// Update the history table, stating that this user viewed this node.
|
||||
node_tag_new($node);
|
||||
}
|
||||
|
||||
return $block;
|
||||
@@ -50,7 +52,8 @@ function ctools_node_comments_content_type_edit_form($form, &$form_state) {
|
||||
foreach (_comment_per_page() as $i) {
|
||||
$options[$i] = t('!a comments per page', array('!a' => $i));
|
||||
}
|
||||
$form['comments_per_page'] = array('#type' => 'select',
|
||||
$form['comments_per_page'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Pager'),
|
||||
'#default_value' => $conf['comments_per_page'],
|
||||
'#options' => $options,
|
||||
|
||||
+7
-6
@@ -1,9 +1,11 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* 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('Node content'),
|
||||
@@ -27,18 +29,18 @@ $plugin = array(
|
||||
* Render the node content.
|
||||
*/
|
||||
function ctools_node_content_content_type_render($subtype, $conf, $panel_args, $context) {
|
||||
if (!empty($context) && empty($context->data)) {
|
||||
if (!empty($context) && (empty($context->data) || empty($context->data->nid))) {
|
||||
return;
|
||||
}
|
||||
|
||||
$node = isset($context->data) ? clone($context->data) : NULL;
|
||||
$node = isset($context->data) ? clone $context->data : NULL;
|
||||
$block = new stdClass();
|
||||
$block->module = 'node';
|
||||
$block->delta = $node->nid;
|
||||
$block->delta = $node->nid;
|
||||
|
||||
if (empty($node)) {
|
||||
$block->delta = 'placeholder';
|
||||
$block->title = t('Node title.');
|
||||
$block->title = t('Node title.');
|
||||
$block->content = t('Node content goes here.');
|
||||
}
|
||||
else {
|
||||
@@ -86,7 +88,7 @@ function ctools_node_content_render_node($node, $conf) {
|
||||
$links['node-readmore'] = array(
|
||||
'title' => t('Read more'),
|
||||
'href' => 'node/' . $node->nid,
|
||||
'attributes' => array('rel' => 'tag', 'title' => strip_tags($node->title))
|
||||
'attributes' => array('rel' => 'tag', 'title' => strip_tags($node->title)),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -201,4 +203,3 @@ function ctools_node_content_content_type_edit_form_submit($form, &$form_state)
|
||||
function ctools_node_content_content_type_admin_title($subtype, $conf, $context) {
|
||||
return t('"@s" content', array('@s' => $context->identifier));
|
||||
}
|
||||
|
||||
|
||||
+4
-2
@@ -1,9 +1,11 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* 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('Node created date'),
|
||||
@@ -20,7 +22,7 @@ $plugin = array(
|
||||
* Render the custom content type.
|
||||
*/
|
||||
function ctools_node_created_content_type_render($subtype, $conf, $panel_args, $context) {
|
||||
if (empty($context) || empty($context->data)) {
|
||||
if (!empty($context) && (empty($context->data) || empty($context->data->nid))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -28,7 +30,7 @@ function ctools_node_created_content_type_render($subtype, $conf, $panel_args, $
|
||||
$node = $context->data;
|
||||
|
||||
// Build the content type block.
|
||||
$block = new stdClass();
|
||||
$block = new stdClass();
|
||||
$block->module = 'node_created';
|
||||
$block->title = t('Created date');
|
||||
$block->content = format_date($node->created, $conf['format']);
|
||||
|
||||
+4
-3
@@ -1,9 +1,11 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* 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('Node links'),
|
||||
@@ -29,10 +31,10 @@ function ctools_node_links_content_type_render($subtype, $conf, $panel_args, $co
|
||||
return;
|
||||
}
|
||||
|
||||
$node = isset($context->data) ? clone($context->data) : NULL;
|
||||
$node = isset($context->data) ? clone $context->data : NULL;
|
||||
$block = new stdClass();
|
||||
$block->module = 'node';
|
||||
$block->delta = $node->nid;
|
||||
$block->delta = $node->nid;
|
||||
|
||||
if (empty($node)) {
|
||||
$block->delta = 'placeholder';
|
||||
@@ -102,4 +104,3 @@ function ctools_node_links_content_type_edit_form_submit($form, &$form_state) {
|
||||
function ctools_node_links_content_type_admin_title($subtype, $conf, $context) {
|
||||
return t('"@s" links', array('@s' => $context->identifier));
|
||||
}
|
||||
|
||||
|
||||
+8
-6
@@ -1,9 +1,11 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* 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('Node terms'),
|
||||
@@ -30,7 +32,7 @@ function ctools_node_terms_content_type_render($subtype, $conf, $panel_args, $co
|
||||
// Get a shortcut to the node.
|
||||
$node = $context->data;
|
||||
|
||||
// Load all terms for this node from all vocabularies
|
||||
// Load all terms for this node from all vocabularies.
|
||||
$query = db_select('taxonomy_index', 't');
|
||||
$result = $query
|
||||
->fields('t')
|
||||
@@ -38,22 +40,22 @@ function ctools_node_terms_content_type_render($subtype, $conf, $panel_args, $co
|
||||
->execute();
|
||||
|
||||
$tids = array();
|
||||
foreach ($result AS $term) {
|
||||
foreach ($result as $term) {
|
||||
$tids[] = $term->tid;
|
||||
}
|
||||
|
||||
// Get the real term objects
|
||||
// Get the real term objects.
|
||||
$term_objects = taxonomy_term_load_multiple($tids);
|
||||
|
||||
$terms = array();
|
||||
|
||||
if (empty($conf['vid'])) {
|
||||
// All terms.
|
||||
foreach ($term_objects AS $term) {
|
||||
foreach ($term_objects as $term) {
|
||||
$terms['taxonomy_term_' . $term->tid] = array(
|
||||
'title' => check_plain($term->name),
|
||||
'href' => 'taxonomy/term/' . $term->tid,
|
||||
'attributes' => array('rel' => 'tag', 'title' => strip_tags($term->description))
|
||||
'attributes' => array('rel' => 'tag', 'title' => strip_tags($term->description)),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -106,7 +108,7 @@ function ctools_node_terms_content_type_render($subtype, $conf, $panel_args, $co
|
||||
}
|
||||
|
||||
// Build the content type block.
|
||||
$block = new stdClass();
|
||||
$block = new stdClass();
|
||||
$block->module = 'node_terms';
|
||||
$block->delta = $node->nid;
|
||||
$block->title = t('Terms');
|
||||
|
||||
+6
-4
@@ -1,9 +1,11 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* 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('Node title'),
|
||||
@@ -23,7 +25,7 @@ $plugin = array(
|
||||
* Render the custom content type.
|
||||
*/
|
||||
function ctools_node_title_content_type_render($subtype, $conf, $panel_args, $context) {
|
||||
if (empty($context) || empty($context->data)) {
|
||||
if (!empty($context) && (empty($context->data) || empty($context->data->nid))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -33,10 +35,10 @@ function ctools_node_title_content_type_render($subtype, $conf, $panel_args, $co
|
||||
// Load information about the node type.
|
||||
$type = node_type_get_type($node);
|
||||
|
||||
// Generate the title
|
||||
// Generate the title.
|
||||
$content = !empty($conf['link']) ? l($node->title, 'node/' . $node->nid) : check_plain($node->title);
|
||||
|
||||
// Build any surrounding markup if so configured
|
||||
// Build any surrounding markup if so configured.
|
||||
if (isset($conf['markup']) && $conf['markup'] != 'none') {
|
||||
$markup = '<' . $conf['markup'];
|
||||
if (!empty($conf['id'])) {
|
||||
@@ -50,7 +52,7 @@ function ctools_node_title_content_type_render($subtype, $conf, $panel_args, $co
|
||||
}
|
||||
|
||||
// Build the content type block.
|
||||
$block = new stdClass();
|
||||
$block = new stdClass();
|
||||
$block->module = 'node_title';
|
||||
$block->title = $type->title_label;
|
||||
$block->content = $content;
|
||||
|
||||
+7
-5
@@ -1,9 +1,11 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* 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('Node type description'),
|
||||
@@ -18,18 +20,18 @@ $plugin = array(
|
||||
* based on the module and delta supplied in the configuration.
|
||||
*/
|
||||
function ctools_node_type_desc_content_type_render($subtype, $conf, $panel_args, $context) {
|
||||
$node = isset($context->data) ? clone($context->data) : NULL;
|
||||
$node = isset($context->data) ? clone $context->data : NULL;
|
||||
$block = new stdClass();
|
||||
$block->module = 'node_type';
|
||||
|
||||
if ($node) {
|
||||
$type = node_type_get_type($node);
|
||||
$block->title = $type->name;
|
||||
$type = node_type_get_type($node);
|
||||
$block->title = $type->name;
|
||||
$block->content = filter_xss_admin($type->description);
|
||||
$block->delta = $node->type;
|
||||
}
|
||||
else {
|
||||
$block->title = t('Node type description');
|
||||
$block->title = t('Node type description');
|
||||
$block->content = t('Node type description goes here.');
|
||||
$block->delta = 'unknown';
|
||||
}
|
||||
@@ -42,6 +44,6 @@ function ctools_node_type_desc_content_type_admin_title($subtype, $conf, $contex
|
||||
}
|
||||
|
||||
function ctools_node_type_desc_content_type_edit_form($form, &$form_state) {
|
||||
// provide a blank form so we have a place to have context setting.
|
||||
// Provide a blank form so we have a place to have context setting.
|
||||
return $form;
|
||||
}
|
||||
|
||||
+4
-2
@@ -1,9 +1,11 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* 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('Node last updated date'),
|
||||
@@ -20,7 +22,7 @@ $plugin = array(
|
||||
* Render the custom content type.
|
||||
*/
|
||||
function ctools_node_updated_content_type_render($subtype, $conf, $panel_args, $context) {
|
||||
if (empty($context) || empty($context->data)) {
|
||||
if (empty($context) || empty($context->data) || empty($context->data->nid)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -28,7 +30,7 @@ function ctools_node_updated_content_type_render($subtype, $conf, $panel_args, $
|
||||
$node = $context->data;
|
||||
|
||||
// Build the content type block.
|
||||
$block = new stdClass();
|
||||
$block = new stdClass();
|
||||
$block->module = 'node_updated';
|
||||
$block->title = t('Last updated date');
|
||||
$block->content = format_date(!empty($node->changed) ? $node->changed : $node->created, $conf['format']);
|
||||
|
||||
+6
-2
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
if (module_exists('upload')) {
|
||||
/**
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
@@ -17,7 +21,7 @@ if (module_exists('upload')) {
|
||||
|
||||
function ctools_node_form_attachments_content_type_render($subtype, $conf, $panel_args, &$context) {
|
||||
$block = new stdClass();
|
||||
$block->module = t('node_form');
|
||||
$block->module = 'node_form';
|
||||
|
||||
$block->title = t('Attach files');
|
||||
$block->delta = 'url-path-options';
|
||||
@@ -46,6 +50,6 @@ function ctools_node_form_attachments_content_type_admin_title($subtype, $conf,
|
||||
}
|
||||
|
||||
function ctools_node_form_attachments_content_type_edit_form($form, &$form_state) {
|
||||
// provide a blank form so we have a place to have context setting.
|
||||
// Provide a blank form so we have a place to have context setting.
|
||||
return $form;
|
||||
}
|
||||
|
||||
+4
-2
@@ -1,9 +1,11 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
* by the system that includes this file.
|
||||
*/
|
||||
|
||||
$plugin = array(
|
||||
'single' => TRUE,
|
||||
'icon' => 'icon_node_form.png',
|
||||
@@ -15,7 +17,7 @@ $plugin = array(
|
||||
|
||||
function ctools_node_form_author_content_type_render($subtype, $conf, $panel_args, &$context) {
|
||||
$block = new stdClass();
|
||||
$block->module = t('node_form');
|
||||
$block->module = 'node_form';
|
||||
|
||||
$block->title = t('Authoring information');
|
||||
$block->delta = 'author-options';
|
||||
@@ -47,6 +49,6 @@ function ctools_node_form_author_content_type_admin_title($subtype, $conf, $cont
|
||||
}
|
||||
|
||||
function ctools_node_form_author_content_type_edit_form($form, &$form_state) {
|
||||
// provide a blank form so we have a place to have context setting.
|
||||
// Provide a blank form so we have a place to have context setting.
|
||||
return $form;
|
||||
}
|
||||
|
||||
+6
-2
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
if (module_exists('book')) {
|
||||
/**
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
@@ -17,7 +21,7 @@ if (module_exists('book')) {
|
||||
|
||||
function ctools_node_form_book_content_type_render($subtype, $conf, $panel_args, &$context) {
|
||||
$block = new stdClass();
|
||||
$block->module = t('node_form');
|
||||
$block->module = 'node_form';
|
||||
|
||||
$block->title = t('Book outline');
|
||||
$block->delta = 'book-outline';
|
||||
@@ -45,6 +49,6 @@ function ctools_node_form_book_content_type_admin_title($subtype, $conf, $contex
|
||||
}
|
||||
|
||||
function ctools_node_form_book_content_type_edit_form($form, &$form_state) {
|
||||
// provide a blank form so we have a place to have context setting.
|
||||
// Provide a blank form so we have a place to have context setting.
|
||||
return $form;
|
||||
}
|
||||
|
||||
+4
-2
@@ -1,9 +1,11 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
* by the system that includes this file.
|
||||
*/
|
||||
|
||||
$plugin = array(
|
||||
'single' => TRUE,
|
||||
'icon' => 'icon_node_form.png',
|
||||
@@ -15,7 +17,7 @@ $plugin = array(
|
||||
|
||||
function ctools_node_form_buttons_content_type_render($subtype, $conf, $panel_args, &$context) {
|
||||
$block = new stdClass();
|
||||
$block->module = t('node_form');
|
||||
$block->module = 'node_form';
|
||||
|
||||
$block->title = '';
|
||||
$block->delta = 'buttons';
|
||||
@@ -38,6 +40,6 @@ function ctools_node_form_buttons_content_type_admin_title($subtype, $conf, $con
|
||||
}
|
||||
|
||||
function ctools_node_form_buttons_content_type_edit_form($form, &$form_state) {
|
||||
// provide a blank form so we have a place to have context setting.
|
||||
// Provide a blank form so we have a place to have context setting.
|
||||
return $form;
|
||||
}
|
||||
|
||||
+6
-2
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
if (module_exists('comment')) {
|
||||
/**
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
@@ -17,7 +21,7 @@ if (module_exists('comment')) {
|
||||
|
||||
function ctools_node_form_comment_content_type_render($subtype, $conf, $panel_args, &$context) {
|
||||
$block = new stdClass();
|
||||
$block->module = t('node_form');
|
||||
$block->module = 'node_form';
|
||||
|
||||
$block->title = t('Comment options');
|
||||
$block->delta = 'comment-options';
|
||||
@@ -45,6 +49,6 @@ function ctools_node_form_comment_content_type_admin_title($subtype, $conf, $con
|
||||
}
|
||||
|
||||
function ctools_node_form_comment_content_type_edit_form($form, &$form_state) {
|
||||
// provide a blank form so we have a place to have context setting.
|
||||
// Provide a blank form so we have a place to have context setting.
|
||||
return $form;
|
||||
}
|
||||
|
||||
+5
-3
@@ -1,9 +1,11 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
* by the system that includes this file.
|
||||
*/
|
||||
|
||||
$plugin = array(
|
||||
'single' => TRUE,
|
||||
'icon' => 'icon_node_form.png',
|
||||
@@ -15,7 +17,7 @@ $plugin = array(
|
||||
|
||||
function ctools_node_form_language_content_type_render($subtype, $conf, $panel_args, &$context) {
|
||||
$block = new stdClass();
|
||||
$block->module = t('node_form');
|
||||
$block->module = 'node_form';
|
||||
|
||||
$block->delta = 'language-options';
|
||||
|
||||
@@ -36,6 +38,6 @@ function ctools_node_form_language_content_type_admin_title($subtype, $conf, $co
|
||||
}
|
||||
|
||||
function ctools_node_form_language_content_type_edit_form($form, &$form_state) {
|
||||
// provide a blank form so we have a place to have context setting.
|
||||
// Provide a blank form so we have a place to have context setting.
|
||||
return $form;
|
||||
}
|
||||
}
|
||||
|
||||
+4
-2
@@ -1,9 +1,11 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
* by the system that includes this file.
|
||||
*/
|
||||
|
||||
$plugin = array(
|
||||
'single' => TRUE,
|
||||
'icon' => 'icon_node_form.png',
|
||||
@@ -15,7 +17,7 @@ $plugin = array(
|
||||
|
||||
function ctools_node_form_log_content_type_render($subtype, $conf, $panel_args, &$context) {
|
||||
$block = new stdClass();
|
||||
$block->module = t('node_form');
|
||||
$block->module = 'node_form';
|
||||
$block->title = t('Revision information');
|
||||
|
||||
if (isset($context->form)) {
|
||||
@@ -42,6 +44,6 @@ function ctools_node_form_log_content_type_admin_title($subtype, $conf, $context
|
||||
}
|
||||
|
||||
function ctools_node_form_log_content_type_edit_form($form, &$form_state) {
|
||||
// provide a blank form so we have a place to have context setting.
|
||||
// Provide a blank form so we have a place to have context setting.
|
||||
return $form;
|
||||
}
|
||||
|
||||
+6
-2
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
if (module_exists('menu')) {
|
||||
/**
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
@@ -17,7 +21,7 @@ if (module_exists('menu')) {
|
||||
|
||||
function ctools_node_form_menu_content_type_render($subtype, $conf, $panel_args, &$context) {
|
||||
$block = new stdClass();
|
||||
$block->module = t('node_form');
|
||||
$block->module = 'node_form';
|
||||
|
||||
$block->title = t('Menu options');
|
||||
$block->delta = 'menu-options';
|
||||
@@ -45,6 +49,6 @@ function ctools_node_form_menu_content_type_admin_title($subtype, $conf, $contex
|
||||
}
|
||||
|
||||
function ctools_node_form_menu_content_type_edit_form($form, &$form_state) {
|
||||
// provide a blank form so we have a place to have context setting.
|
||||
// Provide a blank form so we have a place to have context setting.
|
||||
return $form;
|
||||
}
|
||||
|
||||
+6
-2
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
if (module_exists('path')) {
|
||||
/**
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
@@ -17,7 +21,7 @@ if (module_exists('path')) {
|
||||
|
||||
function ctools_node_form_path_content_type_render($subtype, $conf, $panel_args, &$context) {
|
||||
$block = new stdClass();
|
||||
$block->module = t('node_form');
|
||||
$block->module = 'node_form';
|
||||
|
||||
$block->title = t('URL path options');
|
||||
$block->delta = 'url-path-options';
|
||||
@@ -46,6 +50,6 @@ function ctools_node_form_path_content_type_admin_title($subtype, $conf, $contex
|
||||
}
|
||||
|
||||
function ctools_node_form_path_content_type_edit_form($form, &$form_state) {
|
||||
// provide a blank form so we have a place to have context setting.
|
||||
// Provide a blank form so we have a place to have context setting.
|
||||
return $form;
|
||||
}
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ function ctools_node_form_publishing_content_type_render($subtype, $conf, $panel
|
||||
$block = new stdClass();
|
||||
|
||||
$block->title = t('Publishing options');
|
||||
$block->module = t('node_form');
|
||||
$block->module = 'node_form';
|
||||
$block->delta = 'publishing-options';
|
||||
|
||||
if (isset($context->form)) {
|
||||
@@ -49,6 +49,6 @@ function ctools_node_form_publishing_content_type_admin_title($subtype, $conf, $
|
||||
}
|
||||
|
||||
function ctools_node_form_publishing_content_type_edit_form($form, &$form_state) {
|
||||
// provide a blank form so we have a place to have context setting.
|
||||
// Provide a blank form so we have a place to have context setting.
|
||||
return $form;
|
||||
}
|
||||
|
||||
+4
-2
@@ -1,9 +1,11 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
* by the system that includes this file.
|
||||
*/
|
||||
|
||||
$plugin = array(
|
||||
'single' => TRUE,
|
||||
'icon' => 'icon_node_form.png',
|
||||
@@ -15,7 +17,7 @@ $plugin = array(
|
||||
|
||||
function ctools_node_form_title_content_type_render($subtype, $conf, $panel_args, &$context) {
|
||||
$block = new stdClass();
|
||||
$block->module = t('node_form');
|
||||
$block->module = 'node_form';
|
||||
|
||||
$block->delta = 'title-options';
|
||||
|
||||
@@ -36,6 +38,6 @@ function ctools_node_form_title_content_type_admin_title($subtype, $conf, $conte
|
||||
}
|
||||
|
||||
function ctools_node_form_title_content_type_edit_form($form, &$form_state) {
|
||||
// provide a blank form so we have a place to have context setting.
|
||||
// Provide a blank form so we have a place to have context setting.
|
||||
return $form;
|
||||
}
|
||||
|
||||
@@ -30,4 +30,3 @@ function ctools_page_help_content_type_render($subtype, $conf, $panel_args) {
|
||||
|
||||
return $block;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ function ctools_page_logo_content_type_render($subtype, $conf, $panel_args) {
|
||||
$block = new stdClass();
|
||||
|
||||
if (!empty($logo)) {
|
||||
$image = '<img src="' . $logo . '" alt="' . t('Home') . '" />';
|
||||
$image = theme('image', array('path' => $logo, 'alt' => t('Home')));
|
||||
$block->content = l($image, '', array('html' => TRUE, 'attributes' => array('rel' => 'home', 'id' => 'logo', 'title' => t('Home'))));
|
||||
}
|
||||
|
||||
|
||||
@@ -30,4 +30,3 @@ function ctools_page_messages_content_type_render($subtype, $conf, $panel_args)
|
||||
|
||||
return $block;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,18 +7,48 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
* by the system that includes this file.
|
||||
* Plugins are described by creating a $plugin array which will be used by the
|
||||
* system that includes this file.
|
||||
*/
|
||||
$plugin = array(
|
||||
'title' => t('Site name'),
|
||||
'single' => TRUE,
|
||||
'icon' => 'icon_page.png',
|
||||
'description' => t('The name of the site.'),
|
||||
'description' => t('The name of the site, optionally links to the front page.'),
|
||||
'category' => t('Page elements'),
|
||||
'render last' => TRUE,
|
||||
'defaults' => array(
|
||||
'linked' => FALSE,
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Settings form for the Site Name pane.
|
||||
*/
|
||||
function ctools_page_site_name_content_type_edit_form($form, &$form_state) {
|
||||
$conf = $form_state['conf'];
|
||||
|
||||
$form['linked'] = array(
|
||||
'#title' => t('Linked'),
|
||||
'#description' => t('Link the site name to the home page.'),
|
||||
'#type' => 'checkbox',
|
||||
'#default_value' => isset($conf['linked']) ? $conf['linked'] : FALSE,
|
||||
);
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* The submit form stores the data in $conf.
|
||||
*/
|
||||
function ctools_page_site_name_content_type_edit_form_submit($form, &$form_state) {
|
||||
foreach (array_keys($form_state['plugin']['defaults']) as $key) {
|
||||
if (isset($form_state['values'][$key])) {
|
||||
$form_state['conf'][$key] = $form_state['values'][$key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Output function for the 'page_site_name' content type.
|
||||
*
|
||||
@@ -26,7 +56,13 @@ $plugin = array(
|
||||
*/
|
||||
function ctools_page_site_name_content_type_render($subtype, $conf, $panel_args) {
|
||||
$block = new stdClass();
|
||||
|
||||
$block->content = filter_xss_admin(variable_get('site_name', 'Drupal'));
|
||||
|
||||
// Optionally link the site name to the homepage.
|
||||
if (!empty($conf['linked'])) {
|
||||
$block->content = l($block->content, '<front>', array('html' => TRUE));
|
||||
}
|
||||
|
||||
return $block;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ function ctools_page_tabs_content_type_render($subtype, $conf, $panel_args) {
|
||||
case 'primary':
|
||||
unset($menus['#secondary']);
|
||||
break;
|
||||
|
||||
case 'secondary':
|
||||
unset($menus['#primary']);
|
||||
break;
|
||||
@@ -54,7 +55,6 @@ function ctools_page_tabs_content_type_render($subtype, $conf, $panel_args) {
|
||||
return $block;
|
||||
}
|
||||
|
||||
|
||||
function ctools_page_tabs_content_type_edit_form($form, &$form_state) {
|
||||
$conf = $form_state['conf'];
|
||||
|
||||
|
||||
@@ -29,6 +29,12 @@ $plugin = array(
|
||||
* Outputs the page title of the current page.
|
||||
*/
|
||||
function ctools_page_title_content_type_render($subtype, $conf, $panel_args) {
|
||||
// $conf['override_title'] can have one of these three values.
|
||||
// 0 i.e. hide the title, 1 i.e. no title, and 2 i.e. pane title if it's a
|
||||
// panels page.
|
||||
if (!drupal_get_title() && isset($conf['override_title']) && $conf['override_title'] === 1) {
|
||||
return;
|
||||
}
|
||||
// TODO: This should have a setting or something for the markup.
|
||||
if (empty($conf['markup'])) {
|
||||
$conf['markup'] = 'h1';
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
if (module_exists('search')) {
|
||||
/**
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
@@ -35,10 +39,10 @@ function ctools_search_form_content_type_render($subtype, $conf, $panel_args, $c
|
||||
}
|
||||
|
||||
// Build the content type block.
|
||||
$block = new stdClass();
|
||||
$block->module = 'search';
|
||||
$block->delta = 'form';
|
||||
$block->title = '';
|
||||
$block = new stdClass();
|
||||
$block->module = 'search';
|
||||
$block->delta = 'form';
|
||||
$block->title = '';
|
||||
|
||||
switch ($conf['path_type']) {
|
||||
default:
|
||||
@@ -49,6 +53,7 @@ function ctools_search_form_content_type_render($subtype, $conf, $panel_args, $c
|
||||
$path = $_GET['q'];
|
||||
$path = str_replace($keys, '', $path);
|
||||
break;
|
||||
|
||||
case 'custom':
|
||||
$path = $conf['path'];
|
||||
break;
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
if (module_exists('search')) {
|
||||
/**
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
@@ -42,7 +46,7 @@ function ctools_search_result_content_type_render($subtype, $conf, $panel_args,
|
||||
$keys = $context->data;
|
||||
}
|
||||
|
||||
$conditions = NULL;
|
||||
$conditions = NULL;
|
||||
if (isset($info['conditions_callback']) && function_exists($info['conditions_callback'])) {
|
||||
// Build an optional array of more search conditions.
|
||||
$conditions = $info['conditions_callback']($keys);
|
||||
@@ -59,9 +63,9 @@ function ctools_search_result_content_type_render($subtype, $conf, $panel_args,
|
||||
}
|
||||
|
||||
// Build the content type block.
|
||||
$block = new stdClass();
|
||||
$block->module = 'search';
|
||||
$block->delta = 'result';
|
||||
$block = new stdClass();
|
||||
$block->module = 'search';
|
||||
$block->delta = 'result';
|
||||
|
||||
$results = '';
|
||||
|
||||
@@ -160,7 +164,6 @@ function ctools_search_result_content_type_edit_form($form, &$form_state) {
|
||||
'#title' => t('Display text if no search keywords were submitted'),
|
||||
);
|
||||
|
||||
|
||||
$form['no_key_title'] = array(
|
||||
'#title' => t('Title'),
|
||||
'#type' => 'textfield',
|
||||
|
||||
+7
-4
@@ -1,9 +1,11 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* 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('Term description'),
|
||||
@@ -14,12 +16,12 @@ $plugin = array(
|
||||
);
|
||||
|
||||
function ctools_term_description_content_type_render($subtype, $conf, $panel_args, $context) {
|
||||
$term = isset($context->data) ? clone($context->data) : NULL;
|
||||
$term = isset($context->data) ? clone $context->data : NULL;
|
||||
$block = new stdClass();
|
||||
$block->module = 'node_type';
|
||||
|
||||
$block->title = $term->name;
|
||||
if ($term) {
|
||||
if (!empty($term)) {
|
||||
$block->title = $term->name;
|
||||
$block->content = check_markup($term->description, $term->format, '', TRUE);
|
||||
$block->delta = $term->tid;
|
||||
|
||||
@@ -33,6 +35,7 @@ function ctools_term_description_content_type_render($subtype, $conf, $panel_arg
|
||||
}
|
||||
}
|
||||
else {
|
||||
$block->title = '';
|
||||
$block->content = t('Term description goes here.');
|
||||
$block->delta = 'unknown';
|
||||
}
|
||||
@@ -45,6 +48,6 @@ function ctools_term_description_content_type_admin_title($subtype, $conf, $cont
|
||||
}
|
||||
|
||||
function ctools_term_description_content_type_edit_form($form, &$form_state) {
|
||||
// provide a blank form so we have a place to have context setting.
|
||||
// Provide a blank form so we have a place to have context setting.
|
||||
return $form;
|
||||
}
|
||||
|
||||
+32
-5
@@ -1,9 +1,11 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* 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('List of related terms'),
|
||||
@@ -11,11 +13,17 @@ $plugin = array(
|
||||
'description' => t('Terms related to an existing term; may be child, siblings or top level.'),
|
||||
'required context' => new ctools_context_required(t('Term'), array('term', 'taxonomy_term')),
|
||||
'category' => t('Taxonomy term'),
|
||||
'defaults' => array('title' => '', 'type' => 'child', 'list_type' => 'ul', 'path' => 'taxonomy/term'),
|
||||
'defaults' => array(
|
||||
'title' => '',
|
||||
'type' => 'child',
|
||||
'include_current_term' => FALSE,
|
||||
'list_type' => 'ul',
|
||||
'path' => 'taxonomy/term',
|
||||
),
|
||||
);
|
||||
|
||||
function ctools_term_list_content_type_render($subtype, $conf, $panel_args, $context) {
|
||||
$term = isset($context->data) ? clone($context->data) : NULL;
|
||||
$term = isset($context->data) ? clone $context->data : NULL;
|
||||
$block = new stdClass();
|
||||
$block->module = 'term-list';
|
||||
$path = empty($conf['path']) ? 'taxonomy/term/%tid' : $conf['path'];
|
||||
@@ -34,12 +42,15 @@ function ctools_term_list_content_type_render($subtype, $conf, $panel_args, $con
|
||||
$block->delta = $conf['type'];
|
||||
switch ($conf['type']) {
|
||||
case 'related':
|
||||
// FIXME this no longer exists, must be done with Field API
|
||||
// @todo this no longer exists, must be done with Field API.
|
||||
// $terms = taxonomy_get_related($term->tid);
|
||||
break;
|
||||
|
||||
case 'child':
|
||||
default:
|
||||
if (!empty($conf['include_current_term'])) {
|
||||
$terms[] = $term;
|
||||
}
|
||||
$terms = taxonomy_get_children($term->tid);
|
||||
break;
|
||||
|
||||
@@ -49,6 +60,9 @@ function ctools_term_list_content_type_render($subtype, $conf, $panel_args, $con
|
||||
|
||||
case 'parent':
|
||||
$terms = taxonomy_get_parents($term->tid);
|
||||
if (!empty($conf['include_current_term'])) {
|
||||
$terms[] = $term;
|
||||
}
|
||||
$block->title = count($terms) == 1 ? t('Parent term') : t('Parent terms');
|
||||
break;
|
||||
|
||||
@@ -66,7 +80,7 @@ function ctools_term_list_content_type_render($subtype, $conf, $panel_args, $con
|
||||
|
||||
case 'synonyms':
|
||||
// FIXME this no longer exists, must be done with Field API
|
||||
// $terms = taxonomy_get_synonyms($term->tid);
|
||||
// $terms = taxonomy_get_synonyms($term->tid);.
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -116,6 +130,20 @@ function ctools_term_list_content_type_edit_form($form, &$form_state) {
|
||||
'#suffix' => '</div>',
|
||||
);
|
||||
|
||||
$form['include_current_term'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Include the current term in the list'),
|
||||
'#default_value' => !empty($conf['include_current_term']),
|
||||
'#prefix' => '<div class="clearfix no-float">',
|
||||
'#suffix' => '</div>',
|
||||
'#states' => array(
|
||||
'invisible' => array(
|
||||
':input[name="type"], unique1' => array('!value' => 'child'),
|
||||
':input[name="type"], unique2' => array('!value' => 'parent'),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$form['list_type'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('List type'),
|
||||
@@ -143,4 +171,3 @@ function ctools_term_list_content_type_edit_form_submit($form, &$form_state) {
|
||||
$form_state['conf'][$key] = $form_state['values'][$key];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* 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('Term name'),
|
||||
'icon' => 'icon_term.png',
|
||||
'description' => t('The name of this taxonomy term.'),
|
||||
'required context' => new ctools_context_required(t('Term'), array('term', 'taxonomy_term')),
|
||||
'category' => t('Taxonomy term'),
|
||||
'defaults' => array(
|
||||
'link' => TRUE,
|
||||
'markup' => 'none',
|
||||
'id' => '',
|
||||
'class' => '',
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Render the custom content type.
|
||||
*/
|
||||
function ctools_term_name_content_type_render($subtype, $conf, $panel_args, $context) {
|
||||
if (empty($context) || empty($context->data)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get a shortcut to the term.
|
||||
$term = $context->data;
|
||||
|
||||
// Load the vocabulary.
|
||||
$vocab = taxonomy_vocabulary_load($term->vid);
|
||||
|
||||
// Generate the title.
|
||||
$content = !empty($conf['link']) ? l($term->name, 'taxonomy/term/' . $term->tid) : check_plain($term->name);
|
||||
|
||||
// Build any surrounding markup if so configured.
|
||||
if (isset($conf['markup']) && $conf['markup'] != 'none') {
|
||||
$markup = '<' . $conf['markup'];
|
||||
if (!empty($conf['id'])) {
|
||||
$markup .= ' id="' . $conf['id'] . '"';
|
||||
}
|
||||
if (!empty($conf['class'])) {
|
||||
$markup .= ' class="' . $conf['class'] . '"';
|
||||
}
|
||||
$markup .= '>' . $content . '</' . $conf['markup'] . '>' . "\n";
|
||||
$content = $markup;
|
||||
}
|
||||
|
||||
// Build the content type block.
|
||||
$block = new stdClass();
|
||||
$block->module = 'term_name';
|
||||
$block->title = t('Name');
|
||||
$block->content = $content;
|
||||
$block->delta = $term->tid;
|
||||
|
||||
return $block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an edit form for custom type settings.
|
||||
*/
|
||||
function ctools_term_name_content_type_edit_form($form, &$form_state) {
|
||||
$conf = $form_state['conf'];
|
||||
|
||||
$form['markup'] = array(
|
||||
'#title' => t('Title tag'),
|
||||
'#type' => 'select',
|
||||
'#options' => array(
|
||||
'none' => t('- No tag -'),
|
||||
'h1' => t('h1'),
|
||||
'h2' => t('h2'),
|
||||
'h3' => t('h3'),
|
||||
'h4' => t('h4'),
|
||||
'h5' => t('h5'),
|
||||
'h6' => t('h6'),
|
||||
'div' => t('div'),
|
||||
),
|
||||
'#default_value' => $conf['markup'],
|
||||
);
|
||||
|
||||
$form['id'] = array(
|
||||
'#title' => t('CSS id to use'),
|
||||
'#type' => 'textfield',
|
||||
'#default_value' => $conf['id'],
|
||||
);
|
||||
|
||||
$form['class'] = array(
|
||||
'#title' => t('CSS class to use'),
|
||||
'#type' => 'textfield',
|
||||
'#default_value' => $conf['class'],
|
||||
);
|
||||
|
||||
$form['link'] = array(
|
||||
'#title' => t('Link to term'),
|
||||
'#type' => 'checkbox',
|
||||
'#default_value' => $conf['link'],
|
||||
'#description' => t('Check here to make the name link to the term page.'),
|
||||
);
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit handler for the custom type settings form.
|
||||
*/
|
||||
function ctools_term_name_content_type_edit_form_submit($form, &$form_state) {
|
||||
// Copy everything from our defaults.
|
||||
foreach (array_keys($form_state['plugin']['defaults']) as $key) {
|
||||
$form_state['conf'][$key] = $form_state['values'][$key];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the administrative title for a type.
|
||||
*/
|
||||
function ctools_term_name_content_type_admin_title($subtype, $conf, $context) {
|
||||
return t('"@s" name', array('@s' => $context->identifier));
|
||||
}
|
||||
@@ -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,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -55,8 +62,8 @@ function ctools_token_content_type_content_types() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the custom content type.
|
||||
*/
|
||||
* Render the custom content type.
|
||||
*/
|
||||
function ctools_token_content_type_render($subtype, $conf, $panel_args, $context) {
|
||||
if (empty($context) || empty($context->data)) {
|
||||
return FALSE;
|
||||
@@ -74,7 +81,7 @@ function ctools_token_content_type_render($subtype, $conf, $panel_args, $context
|
||||
}
|
||||
|
||||
// Build the content type block.
|
||||
$block = new stdClass();
|
||||
$block = new stdClass();
|
||||
$block->module = 'ctools';
|
||||
$block->title = $info['tokens'][$entity_type][$name]['name'];
|
||||
$block->content = $values[$name];
|
||||
@@ -84,8 +91,8 @@ function ctools_token_content_type_render($subtype, $conf, $panel_args, $context
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an edit form for custom type settings.
|
||||
*/
|
||||
* Returns an edit form for custom type settings.
|
||||
*/
|
||||
function ctools_token_content_type_edit_form($form, &$form_state) {
|
||||
$conf = $form_state['conf'];
|
||||
|
||||
@@ -106,10 +113,9 @@ function ctools_token_content_type_edit_form_submit($form, &$form_state) {
|
||||
$form_state['conf']['sanitize'] = $form_state['values']['sanitize'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the administrative title for a type.
|
||||
*/
|
||||
* Returns the administrative title for a type.
|
||||
*/
|
||||
function ctools_token_content_type_admin_title($subtype, $conf, $context) {
|
||||
return t('"@s" @name', array('@s' => $context->identifier, '@name' => $subtype));
|
||||
}
|
||||
|
||||
+12
-7
@@ -1,6 +1,10 @@
|
||||
<?php
|
||||
|
||||
if (module_exists('profile') && !is_null(profile_user_categories())) {
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
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.
|
||||
@@ -21,18 +25,18 @@ if (module_exists('profile') && !is_null(profile_user_categories())) {
|
||||
* 'Render' callback for the 'profile fields' content type.
|
||||
*/
|
||||
function ctools_profile_fields_content_type_render($subtype, $conf, $panel_args, $context) {
|
||||
$account = isset($context->data) ? clone($context->data) : NULL;
|
||||
$account = isset($context->data) ? clone $context->data : NULL;
|
||||
$block = new stdClass();
|
||||
$block->module = 'profile fields';
|
||||
|
||||
if ($account) {
|
||||
// Get the category from the options
|
||||
// Get the category from the options.
|
||||
$category = str_replace("_", " ", $conf['category']);
|
||||
|
||||
// Set the subject to the name of the category
|
||||
// Set the subject to the name of the category.
|
||||
$block->subject = $category;
|
||||
|
||||
// Put all the fields in the category into an array
|
||||
// Put all the fields in the category into an array.
|
||||
profile_view_profile($account);
|
||||
|
||||
if (is_array($account->content[$category])) {
|
||||
@@ -46,11 +50,11 @@ function ctools_profile_fields_content_type_render($subtype, $conf, $panel_args,
|
||||
}
|
||||
|
||||
if (count($vars) == 0) {
|
||||
// Output the given empty text
|
||||
// Output the given empty text.
|
||||
$output = $conf['empty'];
|
||||
}
|
||||
else {
|
||||
// Call the theme function with the field vars
|
||||
// Call the theme function with the field vars.
|
||||
$output = theme('profile_fields_pane', $category, $vars);
|
||||
}
|
||||
|
||||
@@ -65,6 +69,7 @@ function ctools_profile_fields_content_type_render($subtype, $conf, $panel_args,
|
||||
|
||||
return $block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function : build the list of categories for the 'edit' form.
|
||||
*/
|
||||
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Display profile fields.
|
||||
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* 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('User links'),
|
||||
'icon' => 'icon_user.png',
|
||||
'description' => t('User links of the referenced user.'),
|
||||
'required context' => new ctools_context_required(t('User'), 'user'),
|
||||
'category' => t('User'),
|
||||
'defaults' => array(
|
||||
'override_title' => FALSE,
|
||||
'override_title_text' => '',
|
||||
'build_mode' => '',
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Output function for the user links.
|
||||
*/
|
||||
function ctools_user_links_content_type_render($subtype, $conf, $panel_args, $context) {
|
||||
if (!empty($context) && empty($context->data)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$account = clone $context->data;
|
||||
$block = new stdClass();
|
||||
$block->module = 'user';
|
||||
$block->delta = $account->uid;
|
||||
|
||||
if (empty($account)) {
|
||||
$block->delta = 'placeholder';
|
||||
$block->subject = t('User name.');
|
||||
$block->content = t('User links go here.');
|
||||
}
|
||||
else {
|
||||
$block->subject = $account->name;
|
||||
user_build_content($account, $conf['build_mode']);
|
||||
if (!empty($account->content['links'])) {
|
||||
$block->content = $account->content['links'];
|
||||
}
|
||||
else {
|
||||
$block->content = '';
|
||||
}
|
||||
}
|
||||
return $block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an edit form for the custom type.
|
||||
*/
|
||||
function ctools_user_links_content_type_edit_form($form, &$form_state) {
|
||||
$conf = $form_state['conf'];
|
||||
|
||||
$entity = entity_get_info('user');
|
||||
$build_mode_options = array();
|
||||
foreach ($entity['view modes'] as $mode => $option) {
|
||||
$build_mode_options[$mode] = $option['label'];
|
||||
}
|
||||
|
||||
$form['build_mode'] = array(
|
||||
'#title' => t('Build mode'),
|
||||
'#type' => 'select',
|
||||
'#description' => t('Select a build mode for this user.'),
|
||||
'#options' => $build_mode_options,
|
||||
'#default_value' => $conf['build_mode'],
|
||||
);
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
function ctools_user_links_content_type_edit_form_submit($form, &$form_state) {
|
||||
// Copy everything from our defaults.
|
||||
foreach (array_keys($form_state['plugin']['defaults']) as $key) {
|
||||
$form_state['conf'][$key] = $form_state['values'][$key];
|
||||
}
|
||||
}
|
||||
|
||||
function ctools_user_links_content_type_admin_title($subtype, $conf, $context) {
|
||||
return t('"@s" links', array('@s' => $context->identifier));
|
||||
}
|
||||
+5
-4
@@ -1,9 +1,11 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* 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('User picture'),
|
||||
@@ -22,7 +24,7 @@ function ctools_user_picture_content_type_render($subtype, $conf, $panel_args, $
|
||||
|
||||
$account = clone $context->data;
|
||||
|
||||
// Check if user has permissions to access the user
|
||||
// Check if user has permissions to access the user.
|
||||
if ($user->uid != $account->uid && (!user_access('access user profiles') && !user_access('administer users'))) {
|
||||
return;
|
||||
}
|
||||
@@ -36,19 +38,18 @@ function ctools_user_picture_content_type_render($subtype, $conf, $panel_args, $
|
||||
'#account' => $account,
|
||||
);
|
||||
|
||||
|
||||
$block->content = $element;
|
||||
return $block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the administrative title for a panel pane in the drag & drop UI
|
||||
* Display the administrative title for a panel pane in the drag & drop UI.
|
||||
*/
|
||||
function ctools_user_picture_content_type_admin_title($subtype, $conf, $context) {
|
||||
return t('"@s" user picture', array('@s' => $context->identifier));
|
||||
}
|
||||
|
||||
function ctools_user_picture_content_type_edit_form($form, &$form_state) {
|
||||
// provide a blank form so we have a place to have context setting.
|
||||
// Provide a blank form so we have a place to have context setting.
|
||||
return $form;
|
||||
}
|
||||
|
||||
+3
-2
@@ -1,9 +1,11 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* 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('User profile'),
|
||||
@@ -20,7 +22,7 @@ $plugin = array(
|
||||
* Render the user profile content type.
|
||||
*/
|
||||
function ctools_user_profile_content_type_render($subtype, $conf, $panel_args, $context) {
|
||||
$account = isset($context->data) ? clone($context->data) : NULL;
|
||||
$account = isset($context->data) ? clone $context->data : NULL;
|
||||
if (!$account) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -84,4 +86,3 @@ function ctools_user_profile_content_type_edit_form($form, &$form_state) {
|
||||
function ctools_user_profile_content_type_edit_form_submit($form, &$form_state) {
|
||||
$form_state['conf']['view_mode'] = $form_state['values']['view_mode'];
|
||||
}
|
||||
|
||||
|
||||
+5
-3
@@ -1,9 +1,11 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
* by the system that includes this file.
|
||||
*/
|
||||
|
||||
$plugin = array(
|
||||
'title' => t('User signature'),
|
||||
'icon' => 'icon_user.png',
|
||||
@@ -13,7 +15,7 @@ $plugin = array(
|
||||
);
|
||||
|
||||
function ctools_user_signature_content_type_render($subtype, $conf, $panel_args, $context) {
|
||||
$account = isset($context->data) ? clone($context->data) : NULL;
|
||||
$account = isset($context->data) ? clone $context->data : NULL;
|
||||
$block = new stdClass();
|
||||
$block->module = 'user-signature';
|
||||
|
||||
@@ -31,13 +33,13 @@ function ctools_user_signature_content_type_render($subtype, $conf, $panel_args,
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the administrative title for a panel pane in the drag & drop UI
|
||||
* Display the administrative title for a panel pane in the drag & drop UI.
|
||||
*/
|
||||
function ctools_user_signature_content_type_admin_title($subtype, $conf, $context) {
|
||||
return t('"@s" user signature', array('@s' => $context->identifier));
|
||||
}
|
||||
|
||||
function ctools_user_signature_content_type_edit_form($form, &$form_state) {
|
||||
// provide a blank form so we have a place to have context setting.
|
||||
// Provide a blank form so we have a place to have context setting.
|
||||
return $form;
|
||||
}
|
||||
|
||||
+8
-5
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
if (module_exists('taxonomy')) {
|
||||
/**
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
@@ -21,8 +25,8 @@ if (module_exists('taxonomy')) {
|
||||
* list of terms for the input vocabulary.
|
||||
*/
|
||||
function ctools_vocabulary_terms_content_type_render($subtype, $conf, $panel_args, $context) {
|
||||
$vocab = isset($context->data) ? clone($context->data) : NULL;
|
||||
$max_depth = (!empty($conf['max_depth']) ? (int)$conf['max_depth'] : NULL);
|
||||
$vocab = isset($context->data) ? clone $context->data : NULL;
|
||||
$max_depth = (!empty($conf['max_depth']) ? (int) $conf['max_depth'] : NULL);
|
||||
if ($conf['tree'] == FALSE) {
|
||||
$terms = taxonomy_get_tree($vocab->vid, 0, $max_depth);
|
||||
$items = array();
|
||||
@@ -35,9 +39,9 @@ function ctools_vocabulary_terms_content_type_render($subtype, $conf, $panel_arg
|
||||
$output = theme('item_list', array('items' => _ctools_content_vocabulary_terms($vocab->vid, $max_depth)));
|
||||
}
|
||||
|
||||
$block = new stdClass();
|
||||
$block = new stdClass();
|
||||
$block->module = 'node_type';
|
||||
$block->title = check_plain($vocab->name);
|
||||
$block->title = check_plain($vocab->name);
|
||||
$block->content = $output;
|
||||
$block->delta = $vocab->vid;
|
||||
|
||||
@@ -97,4 +101,3 @@ function ctools_vocabulary_terms_content_type_edit_form_submit($form, &$form_sta
|
||||
$form_state['conf'][$key] = $form_state['values'][$key];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Plugin to provide a node context. A node context is a node wrapped in a
|
||||
* context object that can be utilized by anything that accepts contexts.
|
||||
*/
|
||||
@@ -23,6 +22,8 @@ $plugin = array(
|
||||
'#type' => 'textfield',
|
||||
'#description' => t('Enter the ID of an entity for this context.'),
|
||||
),
|
||||
// Tell ctools_context_get_context_from_context() how to interpret its $argument.
|
||||
'placeholder name' => 'entity_id',
|
||||
'get child' => 'ctools_context_entity_get_child',
|
||||
'get children' => 'ctools_context_entity_get_children',
|
||||
);
|
||||
@@ -88,9 +89,9 @@ function ctools_context_create_entity($empty, $data = NULL, $conf = FALSE, $plug
|
||||
}
|
||||
|
||||
if (!empty($data)) {
|
||||
$context->data = $data;
|
||||
$context->data = $data;
|
||||
if (!empty($entity['entity keys']['label'])) {
|
||||
$context->title = $data->{$entity['entity keys']['label']};
|
||||
$context->title = $data->{$entity['entity keys']['label']};
|
||||
}
|
||||
$context->argument = $id;
|
||||
|
||||
@@ -159,7 +160,7 @@ function ctools_context_entity_settings_form($form, &$form_state) {
|
||||
* Validate a node.
|
||||
*/
|
||||
function ctools_context_entity_settings_form_validate($form, &$form_state) {
|
||||
// Validate the autocomplete
|
||||
// Validate the autocomplete.
|
||||
if (empty($form_state['values']['entity_id']) && empty($form_state['values']['entity'])) {
|
||||
form_error($form['entity'], t('You must select an entity.'));
|
||||
return;
|
||||
@@ -169,7 +170,7 @@ function ctools_context_entity_settings_form_validate($form, &$form_state) {
|
||||
return;
|
||||
}
|
||||
|
||||
$id = $form_state['values']['entity'];
|
||||
$id = $form_state['values']['entity'];
|
||||
$preg_matches = array();
|
||||
$match = preg_match('/\[id: (\d+)\]/', $id, $preg_matches);
|
||||
if (!$match) {
|
||||
|
||||
@@ -0,0 +1,169 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Ctools context type plugin to hold the current language context.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
* by the system that includes this file.
|
||||
*/
|
||||
$plugin = array(
|
||||
'title' => t('Language'),
|
||||
'description' => t('Language object.'),
|
||||
'context' => 'ctools_context_language_create',
|
||||
'context name' => 'language',
|
||||
'keyword' => 'language',
|
||||
|
||||
// Provides a list of items which are exposed as keywords.
|
||||
'convert list' => 'ctools_language_context_convert_list',
|
||||
// Convert keywords into data.
|
||||
'convert' => 'ctools_language_context_convert',
|
||||
|
||||
'placeholder form' => array(
|
||||
'#type' => 'textfield',
|
||||
'#description' => t('Enter a valid langcode.'),
|
||||
'#value' => $GLOBALS['language']->language,
|
||||
),
|
||||
|
||||
// Provide settings for the context.
|
||||
'edit form' => 'ctools_context_language_settings_form',
|
||||
'settings' => ctools_context_language_conf_defaults(),
|
||||
);
|
||||
|
||||
/**
|
||||
* Ensures a full populated settings array with sane defaults.
|
||||
*
|
||||
* @param mixed $conf
|
||||
* Array with the user defined settings, or a string identifying a language.
|
||||
*
|
||||
* @return array
|
||||
* Array with all available settings.
|
||||
*/
|
||||
function ctools_context_language_conf_defaults($conf = array()) {
|
||||
if (!is_array($conf)) {
|
||||
$conf = array(
|
||||
'preset_langcode' => (string) $conf,
|
||||
);
|
||||
}
|
||||
|
||||
return $conf + array(
|
||||
'enable_cache_argument' => TRUE,
|
||||
'language_type' => 'language',
|
||||
'preset_langcode' => $GLOBALS['language']->language,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a context, either from manual configuration or the current language.
|
||||
*/
|
||||
function ctools_context_language_create($empty, $data = NULL, $conf = FALSE) {
|
||||
$context = new ctools_context('language');
|
||||
$context->plugin = 'language';
|
||||
if ($empty) {
|
||||
return $context;
|
||||
}
|
||||
$context->title = t('Language');
|
||||
|
||||
$settings = ctools_context_language_conf_defaults($data);
|
||||
if ($settings['language_type'] != 'preset') {
|
||||
$language_object = $GLOBALS[$settings['language_type']];
|
||||
}
|
||||
else {
|
||||
// Fetch the enabled language objects.
|
||||
$languages = language_list('enabled');
|
||||
$languages = $languages[1];
|
||||
|
||||
// Set the custom language, but fallback to the interface language.
|
||||
$language_object = $GLOBALS['language'];
|
||||
if (isset($languages[$settings['preset_langcode']])) {
|
||||
$language_object = $languages[$settings['preset_langcode']];
|
||||
}
|
||||
}
|
||||
// If enabled set the argument ot use in the cid.
|
||||
if ($settings['enable_cache_argument']) {
|
||||
$context->argument = $language_object->language;
|
||||
}
|
||||
$context->data = $language_object;
|
||||
return $context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide a list of sub-keywords.
|
||||
*
|
||||
* This is used to provide keywords from the context for use in a content type,
|
||||
* pane, etc.
|
||||
*/
|
||||
function ctools_language_context_convert_list() {
|
||||
$context = new stdClass();
|
||||
$context->data = $GLOBALS['language'];
|
||||
return array(
|
||||
'language' => t('Langcode. E.g. !example', array('!example' => ctools_language_context_convert($context, 'language'))),
|
||||
'name' => t('Name. E.g. !example', array('!example' => ctools_language_context_convert($context, 'name'))),
|
||||
'native' => t('Native name of the language. E.g. !example', array('!example' => ctools_language_context_convert($context, 'native'))),
|
||||
'direction' => t('Text direction 0=LRT, 1=RTL. E.g. !example', array('!example' => ctools_language_context_convert($context, 'direction'))),
|
||||
'enabled' => t('Status. E.g. !example', array('!example' => ctools_language_context_convert($context, 'enabled'))),
|
||||
'plurals' => t('Number of plural forms. E.g. !example', array('!example' => ctools_language_context_convert($context, 'plurals'))),
|
||||
'formula' => t('Plural formula. E.g. !example', array('!example' => ctools_language_context_convert($context, 'formula'))),
|
||||
'domain' => t('Domain prefix. E.g. !example', array('!example' => ctools_language_context_convert($context, 'domain'))),
|
||||
'prefix' => t('Url prefix . E.g. !example', array('!example' => ctools_language_context_convert($context, 'prefix'))),
|
||||
'weight' => t('The weight. E.g. !example', array('!example' => ctools_language_context_convert($context, 'weight'))),
|
||||
'javascript' => t('Key of the javascript file with the translations. E.g. !example', array('!example' => ctools_language_context_convert($context, 'javascript'))),
|
||||
'provider' => t('Negotiation method that defined the language. E.g. !example', array('!example' => ctools_language_context_convert($context, 'provider'))),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a context property into a string to be used as a keyword.
|
||||
*/
|
||||
function ctools_language_context_convert($context, $type) {
|
||||
if (isset($context->data->$type)) {
|
||||
return $context->data->$type;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings form.
|
||||
*/
|
||||
function ctools_context_language_settings_form($form, &$form_state) {
|
||||
$conf = ctools_context_language_conf_defaults($form_state['conf']);
|
||||
|
||||
$form['enable_cache_argument'] = array(
|
||||
'#title' => t('Add language to cache id'),
|
||||
'#description' => t('If enabled the langcode will be part of context aware caches.'),
|
||||
'#type' => 'checkbox',
|
||||
'#default_value' => $conf['enable_cache_argument'],
|
||||
);
|
||||
|
||||
// Prepare language type options.
|
||||
$language_type_options = drupal_map_assoc(language_types());
|
||||
$language_type_options['preset'] = t('Custom');
|
||||
|
||||
$form['language_type'] = array(
|
||||
'#title' => t('The language type to use'),
|
||||
'#type' => 'radios',
|
||||
'#required' => TRUE,
|
||||
'#options' => $language_type_options,
|
||||
'#default_value' => $conf['language_type'],
|
||||
);
|
||||
|
||||
ctools_include('language');
|
||||
$language_options = ctools_language_list();
|
||||
$form['preset_langcode'] = array(
|
||||
'#title' => t('Language'),
|
||||
'#type' => 'select',
|
||||
'#options' => $language_options,
|
||||
'#default_value' => $conf['preset_langcode'],
|
||||
'#states' => array(
|
||||
'visible' => array(
|
||||
':input[name="language_type"]' => array('value' => 'preset'),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
if (!empty($conf['preset_langcode']) && !isset($language_options[$conf['preset_langcode']])) {
|
||||
drupal_set_message(t('The currently selected language %langcode is no longer available.', array('%langcode' => $conf['preset_langcode'])), 'error', FALSE);
|
||||
}
|
||||
return $form;
|
||||
}
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Plugin to provide a node context. A node context is a node wrapped in a
|
||||
* context object that can be utilized by anything that accepts contexts.
|
||||
*/
|
||||
@@ -106,7 +105,7 @@ function ctools_context_node_settings_form($form, &$form_state) {
|
||||
* Validate a node.
|
||||
*/
|
||||
function ctools_context_node_settings_form_validate($form, &$form_state) {
|
||||
// Validate the autocomplete
|
||||
// Validate the autocomplete.
|
||||
if (empty($form_state['values']['nid']) && empty($form_state['values']['node'])) {
|
||||
form_error($form['node'], t('You must select a node.'));
|
||||
return;
|
||||
@@ -133,7 +132,7 @@ function ctools_context_node_settings_form_validate($form, &$form_state) {
|
||||
$node = db_query('SELECT nid, status FROM {node} WHERE LOWER(title) = LOWER(:title)', array(':title' => $nid))->fetchObject();
|
||||
}
|
||||
|
||||
// Do not allow unpublished nodes to be selected by unprivileged users
|
||||
// Do not allow unpublished nodes to be selected by unprivileged users.
|
||||
if (!$node || (empty($node->status) && !(user_access('administer nodes')))) {
|
||||
form_error($form['node'], t('Invalid node selected.'));
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user