updated etxlink, ctools, colorbox, computed_field
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
|
@@ -48,7 +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);
|
||||
@@ -68,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'];
|
||||
@@ -88,7 +88,7 @@ function ctools_entity_field_value_ctools_access_settings($form, &$form_state, $
|
||||
$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,
|
||||
);
|
||||
|
||||
@@ -115,7 +115,7 @@ function ctools_entity_field_value_ctools_access_settings($form, &$form_state, $
|
||||
$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.
|
||||
// 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']);
|
||||
}
|
||||
@@ -145,7 +145,8 @@ function ctools_entity_field_value_ctools_access_settings_submit($form, &$form_s
|
||||
function _ctools_entity_field_value_get_proper_form_items($field, $form_items, $columns) {
|
||||
$items = array();
|
||||
|
||||
if (!is_array($form_items)) { // Single value item.
|
||||
// Single value item.
|
||||
if (!is_array($form_items)) {
|
||||
foreach ($columns as $column) {
|
||||
$items[0][$column] = $form_items;
|
||||
}
|
||||
@@ -175,7 +176,7 @@ function _ctools_entity_field_value_get_proper_form_items($field, $form_items, $
|
||||
foreach ($columns as $column) {
|
||||
if (isset($form_items[$column])) {
|
||||
$has_columns = TRUE;
|
||||
$item[$column] = $form_items[$column];
|
||||
$item[$column] = $form_items[$column];
|
||||
}
|
||||
else {
|
||||
$item[$column] = '';
|
||||
@@ -353,7 +354,7 @@ function ctools_entity_field_value_ctools_access_summary($conf, $context, $plugi
|
||||
$display['type'] = 'entityreference_label';
|
||||
break;
|
||||
|
||||
default :
|
||||
default:
|
||||
// Use field instance formatter setting.
|
||||
break;
|
||||
}
|
||||
@@ -381,7 +382,7 @@ function ctools_entity_field_value_ctools_access_summary($conf, $context, $plugi
|
||||
if (is_array($elements)) {
|
||||
foreach ($elements as $element_key => $element) {
|
||||
if (is_numeric($element_key)) {
|
||||
$value_str= strip_tags(drupal_render($element));
|
||||
$value_str = strip_tags(drupal_render($element));
|
||||
if (strlen($value_str) > 0) {
|
||||
$output[] = $value_str;
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Plugin to provide access control based upon node comment status.
|
||||
|
@@ -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;
|
||||
|
@@ -23,7 +23,7 @@ function ctools_query_string_exists_ctools_access_settings($form, &$form_state,
|
||||
'#description' => t('Enter the key of the query string.'),
|
||||
'#type' => 'textfield',
|
||||
'#required' => TRUE,
|
||||
'#default_value' => $config['key']
|
||||
'#default_value' => $config['key'],
|
||||
);
|
||||
|
||||
return $form;
|
||||
|
@@ -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,14 +57,19 @@ function ctools_string_length_ctools_access_check($conf, $context) {
|
||||
switch ($conf['operator']) {
|
||||
case '<':
|
||||
return $length < $conf['length'];
|
||||
|
||||
case '<=':
|
||||
return $length <= $conf['length'];
|
||||
|
||||
case '=':
|
||||
return $length == $conf['length'];
|
||||
|
||||
case '!=':
|
||||
return $length != $conf['length'];
|
||||
|
||||
case '>':
|
||||
return $length > $conf['length'];
|
||||
|
||||
case '>=':
|
||||
return $length >= $conf['length'];
|
||||
}
|
||||
|
@@ -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.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -20,12 +20,12 @@ $plugin = array(
|
||||
'required context' => new ctools_context_required(t('Vocabulary'), array(
|
||||
'taxonomy_term',
|
||||
'terms',
|
||||
'taxonomy_vocabulary'
|
||||
'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();
|
||||
@@ -101,7 +101,7 @@ function ctools_term_vocabulary_ctools_access_summary($conf, $context) {
|
||||
|
||||
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
|
||||
'@identifier' => $context->identifier,
|
||||
));
|
||||
}
|
||||
|
||||
@@ -123,5 +123,3 @@ function _ctools_term_vocabulary_ctools_access_map_vids(&$conf) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -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,7 +2,6 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Plugin to provide an argument handler for all entity ids.
|
||||
*/
|
||||
|
||||
|
@@ -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.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -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,7 +11,7 @@
|
||||
*/
|
||||
$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',
|
||||
@@ -67,7 +66,7 @@ function ctools_term_context($arg = NULL, $conf = NULL, $empty = FALSE) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -92,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.
|
||||
@@ -137,10 +136,9 @@ 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) {
|
||||
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);
|
||||
@@ -157,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',
|
||||
@@ -190,13 +189,14 @@ function ctools_term_breadcrumb($conf, $context) {
|
||||
*
|
||||
* @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) {
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
$plugin = array(
|
||||
// cache plugins are the rare plugin types that have no real UI but
|
||||
// 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',
|
||||
|
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
$plugin = array(
|
||||
// cache plugins are the rare plugin types that have no real UI but
|
||||
// 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',
|
||||
|
@@ -51,7 +51,7 @@ function ctools_block_content_type_content_types() {
|
||||
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;
|
||||
@@ -168,7 +168,7 @@ function ctools_block_content_type_render($subtype, $conf) {
|
||||
if ($module == 'block' && !empty($info) && isset($info->title)) {
|
||||
$block->title = $info->title;
|
||||
}
|
||||
else if (isset($block->subject)) {
|
||||
elseif (isset($block->subject)) {
|
||||
$block->title = $block->subject;
|
||||
}
|
||||
else {
|
||||
@@ -208,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.
|
||||
*/
|
||||
@@ -338,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');
|
||||
@@ -360,7 +298,7 @@ function forum_ctools_block_info($module, $delta, &$info) {
|
||||
break;
|
||||
|
||||
default:
|
||||
// safety net
|
||||
// Safety net.
|
||||
ctools_default_block_info($module, $delta, $info);
|
||||
}
|
||||
}
|
||||
@@ -455,7 +393,7 @@ function user_ctools_block_info($module, $delta, &$info) {
|
||||
break;
|
||||
|
||||
default:
|
||||
// safety net
|
||||
// Safety net.
|
||||
ctools_default_block_info($module, $delta, $info);
|
||||
}
|
||||
}
|
||||
@@ -508,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;
|
||||
|
||||
@@ -537,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 {
|
||||
|
@@ -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('Comment created date'),
|
||||
@@ -28,7 +30,7 @@ function ctools_comment_created_content_type_render($subtype, $conf, $panel_args
|
||||
$comment = $context->data;
|
||||
|
||||
// Build the content type block.
|
||||
$block = new stdClass();
|
||||
$block = new stdClass();
|
||||
$block->module = 'comment_created';
|
||||
$block->title = t('Created date');
|
||||
$block->content = format_date($comment->created, $conf['format']);
|
||||
|
@@ -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('Comment links'),
|
||||
@@ -29,7 +31,7 @@ function ctools_comment_links_content_type_render($subtype, $conf, $panel_args,
|
||||
$comment = isset($context->data) ? clone $context->data : NULL;
|
||||
$block = new stdClass();
|
||||
$block->module = 'comment';
|
||||
$block->delta = $comment->cid;
|
||||
$block->delta = $comment->cid;
|
||||
|
||||
if (empty($comment)) {
|
||||
$block->delta = 'placeholder';
|
||||
|
@@ -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,12 +14,12 @@ 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),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,9 @@ function ctools_comment_reply_form_content_type_render($subtype, $conf, $panel_a
|
||||
$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];
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -178,12 +178,11 @@ 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'];
|
||||
if (!empty($contexts) && !empty($settings['substitute'])) {
|
||||
@@ -270,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(
|
||||
@@ -320,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>.');
|
||||
}
|
||||
@@ -417,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;
|
||||
@@ -427,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.'));
|
||||
}
|
||||
@@ -447,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);
|
||||
@@ -455,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];
|
||||
}
|
||||
|
@@ -96,8 +96,8 @@ function ctools_entity_field_content_type_content_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;
|
||||
@@ -157,13 +157,17 @@ function ctools_entity_field_content_type_render($subtype, $conf, $panel_args, $
|
||||
|
||||
$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'];
|
||||
}
|
||||
@@ -175,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();
|
||||
@@ -230,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(),
|
||||
|
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
$plugin = array(
|
||||
'title' => t('Entity extra field'),
|
||||
'defaults' => array('view_mode' => NULL),
|
||||
@@ -119,7 +123,7 @@ function ctools_entity_field_extra_content_type_render($subtype, $conf, $panel_a
|
||||
|
||||
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;
|
||||
|
@@ -38,10 +38,13 @@ function ctools_entity_form_field_content_type_content_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'),
|
||||
@@ -72,7 +75,7 @@ function ctools_entity_form_field_content_type_content_types() {
|
||||
}
|
||||
$content_types[$entity_type . ':' . $group_name]['types'][$type] = $bundle['label'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -90,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;
|
||||
@@ -146,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);
|
||||
|
||||
@@ -162,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;
|
||||
}
|
||||
|
@@ -46,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;
|
||||
}
|
||||
}
|
||||
@@ -121,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">',
|
||||
@@ -179,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;
|
||||
}
|
||||
@@ -205,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'));
|
||||
}
|
||||
|
@@ -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'),
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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));
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
if (module_exists('book')) {
|
||||
/**
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
@@ -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;
|
||||
}
|
||||
|
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
if (module_exists('book')) {
|
||||
/**
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
@@ -8,7 +12,7 @@ if (module_exists('book')) {
|
||||
$plugin = array(
|
||||
'single' => TRUE,
|
||||
'title' => t('Book navigation menu'),
|
||||
'icon' => '../block/icon_core_block_menu.png',
|
||||
'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'),
|
||||
@@ -16,7 +20,7 @@ if (module_exists('book')) {
|
||||
}
|
||||
|
||||
function ctools_node_book_menu_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_menu';
|
||||
|
||||
@@ -61,16 +65,16 @@ function ctools_node_book_menu_content_type_render($subtype, $conf, $panel_args,
|
||||
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');
|
||||
->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
|
||||
// TODO: subject is not rendered.
|
||||
$block->subject = theme('book_title_link', array('link' => $data['link']));
|
||||
$block->content = ($data['below']) ? menu_tree_output($data['below']) : '';
|
||||
}
|
||||
@@ -92,7 +96,7 @@ 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
|
||||
// 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'];
|
||||
}
|
||||
|
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
if (module_exists('book')) {
|
||||
/**
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
@@ -8,7 +12,7 @@ if (module_exists('book')) {
|
||||
$plugin = array(
|
||||
'single' => TRUE,
|
||||
'title' => t('Book navigation pager'),
|
||||
'icon' => '../block/icon_core_booknavigation.png',
|
||||
'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'),
|
||||
@@ -38,6 +42,6 @@ function ctools_node_book_nav_content_type_admin_title($subtype, $conf, $context
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
@@ -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,4 +79,3 @@ function ctools_node_comment_form_content_type_edit_form_submit($form, &$form_st
|
||||
$form_state['conf'][$key] = $form_state['values'][$key];
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
if (module_exists('comment')) {
|
||||
/**
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
@@ -26,7 +30,7 @@ function ctools_node_comment_wrapper_content_type_render($subtype, $conf, $panel
|
||||
$node = isset($context->data) ? clone $context->data : NULL;
|
||||
$block = new stdClass();
|
||||
$block->module = 'comments';
|
||||
$block->delta = $node->nid;
|
||||
$block->delta = $node->nid;
|
||||
|
||||
$renderable = array(
|
||||
'#theme' => 'comment_wrapper__node_' . $node->type,
|
||||
@@ -65,7 +69,7 @@ function ctools_node_comment_wrapper_content_type_render($subtype, $conf, $panel
|
||||
);
|
||||
$renderable['comment_form'] = drupal_build_form('comment_node_' . $node->type . '_form', $form_state);
|
||||
}
|
||||
else if (!empty($conf['anon_links'])) {
|
||||
elseif (!empty($conf['anon_links'])) {
|
||||
$renderable['comment_form'] = theme('comment_post_forbidden', array('node' => $node));
|
||||
}
|
||||
}
|
||||
@@ -90,7 +94,8 @@ function ctools_node_comment_wrapper_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,
|
||||
|
@@ -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,
|
||||
|
@@ -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;
|
||||
$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));
|
||||
}
|
||||
|
||||
|
@@ -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']);
|
||||
|
@@ -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'),
|
||||
@@ -32,7 +34,7 @@ function ctools_node_links_content_type_render($subtype, $conf, $panel_args, $co
|
||||
$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));
|
||||
}
|
||||
|
||||
|
@@ -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');
|
||||
|
@@ -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;
|
||||
|
@@ -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'),
|
||||
@@ -23,13 +25,13 @@ function ctools_node_type_desc_content_type_render($subtype, $conf, $panel_args,
|
||||
$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;
|
||||
}
|
||||
|
@@ -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'),
|
||||
@@ -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']);
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -61,7 +61,7 @@ function ctools_page_site_name_content_type_render($subtype, $conf, $panel_args)
|
||||
|
||||
// Optionally link the site name to the homepage.
|
||||
if (!empty($conf['linked'])) {
|
||||
$block->content = l($block->content, '<front>');
|
||||
$block->content = l($block->content, '<front>', array('html' => TRUE));
|
||||
}
|
||||
|
||||
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,7 +29,10 @@ $plugin = array(
|
||||
* Outputs the page title of the current page.
|
||||
*/
|
||||
function ctools_page_title_content_type_render($subtype, $conf, $panel_args) {
|
||||
if (!drupal_get_title()) {
|
||||
// $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.
|
||||
|
@@ -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',
|
||||
|
@@ -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'),
|
||||
@@ -46,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;
|
||||
}
|
||||
|
@@ -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'),
|
||||
@@ -40,7 +42,7 @@ 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;
|
||||
|
||||
@@ -78,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;
|
||||
}
|
||||
|
||||
@@ -169,4 +171,3 @@ function ctools_term_list_content_type_edit_form_submit($form, &$form_state) {
|
||||
$form_state['conf'][$key] = $form_state['values'][$key];
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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 name'),
|
||||
@@ -19,7 +21,6 @@ $plugin = array(
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Render the custom content type.
|
||||
*/
|
||||
@@ -34,10 +35,10 @@ function ctools_term_name_content_type_render($subtype, $conf, $panel_args, $con
|
||||
// Load the vocabulary.
|
||||
$vocab = taxonomy_vocabulary_load($term->vid);
|
||||
|
||||
// Generate the title
|
||||
// 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
|
||||
// Build any surrounding markup if so configured.
|
||||
if (isset($conf['markup']) && $conf['markup'] != 'none') {
|
||||
$markup = '<' . $conf['markup'];
|
||||
if (!empty($conf['id'])) {
|
||||
@@ -51,7 +52,7 @@ function ctools_term_name_content_type_render($subtype, $conf, $panel_args, $con
|
||||
}
|
||||
|
||||
// Build the content type block.
|
||||
$block = new stdClass();
|
||||
$block = new stdClass();
|
||||
$block->module = 'term_name';
|
||||
$block->title = t('Name');
|
||||
$block->content = $content;
|
||||
|
@@ -62,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;
|
||||
@@ -81,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];
|
||||
@@ -91,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'];
|
||||
|
||||
@@ -113,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));
|
||||
}
|
||||
|
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @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
|
||||
@@ -26,13 +30,13 @@ function ctools_profile_fields_content_type_render($subtype, $conf, $panel_args,
|
||||
$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,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Display profile fields.
|
||||
|
@@ -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 links'),
|
||||
@@ -29,7 +31,7 @@ function ctools_user_links_content_type_render($subtype, $conf, $panel_args, $co
|
||||
$account = clone $context->data;
|
||||
$block = new stdClass();
|
||||
$block->module = 'user';
|
||||
$block->delta = $account->uid;
|
||||
$block->delta = $account->uid;
|
||||
|
||||
if (empty($account)) {
|
||||
$block->delta = 'placeholder';
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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'),
|
||||
@@ -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'];
|
||||
}
|
||||
|
||||
|
@@ -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',
|
||||
@@ -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;
|
||||
}
|
||||
|
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
if (module_exists('taxonomy')) {
|
||||
/**
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
@@ -22,7 +26,7 @@ if (module_exists('taxonomy')) {
|
||||
*/
|
||||
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);
|
||||
$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.'));
|
||||
}
|
||||
|
@@ -2,8 +2,7 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Plugin to provide a node_add_form context
|
||||
* Plugin to provide a node_add_form context.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -65,8 +64,8 @@ function ctools_context_create_node_add_form($empty, $data = NULL, $conf = FALSE
|
||||
$form_state = array(
|
||||
'want form' => TRUE,
|
||||
'build_info' => array(
|
||||
'args' => array($node)
|
||||
)
|
||||
'args' => array($node),
|
||||
),
|
||||
);
|
||||
|
||||
// Use module_load_include so that caches and stuff can know to load this.
|
||||
@@ -81,10 +80,10 @@ function ctools_context_create_node_add_form($empty, $data = NULL, $conf = FALSE
|
||||
|
||||
// These are specific pieces of data to this form.
|
||||
// All forms should place the form here.
|
||||
$context->form = $form;
|
||||
$context->form_id = $form_id;
|
||||
$context->form_title = t('Submit @name', array('@name' => $types[$type]->name));
|
||||
$context->node_type = $type;
|
||||
$context->form = $form;
|
||||
$context->form_id = $form_id;
|
||||
$context->form_title = t('Submit @name', array('@name' => $types[$type]->name));
|
||||
$context->node_type = $type;
|
||||
$context->restrictions['type'] = array($type);
|
||||
$context->restrictions['form'] = array('form');
|
||||
|
||||
|
@@ -2,8 +2,7 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Plugin to provide a node_edit_form context
|
||||
* Plugin to provide a node_edit_form context.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -32,7 +31,7 @@ $plugin = array(
|
||||
*/
|
||||
function ctools_context_create_node_edit_form($empty, $node = NULL, $conf = FALSE) {
|
||||
static $creating = FALSE;
|
||||
$context = new ctools_context(array('form', 'node_edit', 'node_form', 'node_edit_form', 'node', 'entity:node'));
|
||||
$context = new ctools_context(array('form', 'node_edit', 'node_form', 'node_edit_form', 'node', 'entity:node'));
|
||||
$context->plugin = 'node_edit_form';
|
||||
|
||||
if ($empty || ($creating)) {
|
||||
@@ -69,7 +68,7 @@ function ctools_context_create_node_edit_form($empty, $node = NULL, $conf = FALS
|
||||
|
||||
$form = drupal_build_form($form_id, $form_state);
|
||||
|
||||
// Fill in the 'node' portion of the context
|
||||
// Fill in the 'node' portion of the context.
|
||||
$context->data = $node;
|
||||
$context->title = isset($node->title) ? $node->title : '';
|
||||
$context->argument = isset($node->nid) ? $node->nid : $node->type;
|
||||
@@ -126,7 +125,7 @@ function ctools_context_node_edit_form_settings_form($form, &$form_state) {
|
||||
* Validate a node.
|
||||
*/
|
||||
function ctools_context_node_edit_form_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;
|
||||
@@ -153,7 +152,7 @@ function ctools_context_node_edit_form_settings_form_validate($form, &$form_stat
|
||||
$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