updated etxlink, ctools, colorbox, computed_field
This commit is contained in:
@@ -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.'));
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file query_string.inc
|
||||
* @file
|
||||
* Context plugin that can extract arbitrary values from the query string.
|
||||
*/
|
||||
|
||||
@@ -52,7 +52,7 @@ function ctools_context_query_string_settings_form($form, &$form_state) {
|
||||
'#title' => t('Query string key'),
|
||||
'#description' => t('Enter the key of the value that must be returned from the query string.'),
|
||||
'#type' => 'textfield',
|
||||
'#required' => TRUE
|
||||
'#required' => TRUE,
|
||||
);
|
||||
if (isset($form_state['conf']['key'])) {
|
||||
$form['key']['#default_value'] = $form_state['conf']['key'];
|
||||
@@ -83,6 +83,7 @@ function ctools_context_query_string_convert($context, $type) {
|
||||
switch ($type) {
|
||||
case 'raw':
|
||||
return $context->data;
|
||||
|
||||
case 'html_safe':
|
||||
return check_plain($context->data);
|
||||
}
|
||||
|
@@ -2,8 +2,7 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Plugin to provide a string context
|
||||
* Plugin to provide a string context.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -38,7 +37,6 @@ $plugin = array(
|
||||
function ctools_context_create_string($empty, $data = NULL, $conf = FALSE) {
|
||||
// The input is expected to be an object as created by ctools_break_phrase
|
||||
// which contains a group of string.
|
||||
|
||||
$context = new ctools_context('string');
|
||||
$context->plugin = 'string';
|
||||
|
||||
@@ -46,7 +44,7 @@ function ctools_context_create_string($empty, $data = NULL, $conf = FALSE) {
|
||||
return $context;
|
||||
}
|
||||
|
||||
if ($data !== FALSE ) {
|
||||
if ($data !== FALSE) {
|
||||
// Support the array storage from the settings form but also handle direct input from arguments.
|
||||
$context->data = is_array($data) ? $data['string'] : $data;
|
||||
$context->title = ($conf) ? check_plain($data['identifier']) : check_plain($data);
|
||||
@@ -61,8 +59,10 @@ function ctools_context_string_convert($context, $type) {
|
||||
switch ($type) {
|
||||
case 'raw':
|
||||
return $context->data;
|
||||
|
||||
case 'html_safe':
|
||||
return check_plain($context->data);
|
||||
|
||||
case 'uppercase_words_html_safe':
|
||||
return ucwords(str_replace('-', ' ', check_plain($context->data)));
|
||||
}
|
||||
|
@@ -2,8 +2,7 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Plugin to provide a term context
|
||||
* Plugin to provide a term context.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -116,7 +115,7 @@ function ctools_context_term_settings_form($form, &$form_state) {
|
||||
* Validate a term.
|
||||
*/
|
||||
function ctools_context_term_settings_form_validate($form, &$form_state) {
|
||||
// Validate the autocomplete
|
||||
// Validate the autocomplete.
|
||||
$vid = $form_state['values']['vid'];
|
||||
if (empty($form_state['values']['tid']) && empty($form_state['values']['taxonomy'][$vid])) {
|
||||
form_error($form['taxonomy'][$vid], t('You must select a term.'));
|
||||
@@ -154,12 +153,16 @@ function ctools_context_term_convert($context, $type) {
|
||||
switch ($type) {
|
||||
case 'tid':
|
||||
return $context->data->tid;
|
||||
|
||||
case 'name':
|
||||
return $context->data->name;
|
||||
|
||||
case 'name_dashed':
|
||||
return drupal_strtolower(str_replace(' ', '-', $context->data->name));
|
||||
|
||||
case 'vid':
|
||||
return $context->data->vid;
|
||||
|
||||
case 'description':
|
||||
return $context->data->description;
|
||||
}
|
||||
|
@@ -2,8 +2,7 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Plugin to provide a terms context
|
||||
* Plugin to provide a terms context.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -37,7 +36,6 @@ $plugin = array(
|
||||
function ctools_context_create_terms($empty, $data = NULL, $conf = FALSE) {
|
||||
// The input is expected to be an object as created by ctools_break_phrase
|
||||
// which contains a group of terms.
|
||||
|
||||
$context = new ctools_context(array('terms', 'entity:taxonomy_term'));
|
||||
$context->plugin = 'terms';
|
||||
|
||||
@@ -49,7 +47,7 @@ function ctools_context_create_terms($empty, $data = NULL, $conf = FALSE) {
|
||||
$context->operator = $data->operator;
|
||||
$context->tids = $data->value;
|
||||
if (!isset($data->term)) {
|
||||
// load the first term:
|
||||
// Load the first term:
|
||||
reset($context->tids);
|
||||
$data->term = taxonomy_term_load(current($context->tids));
|
||||
}
|
||||
@@ -67,12 +65,16 @@ function ctools_context_terms_convert($context, $type) {
|
||||
switch ($type) {
|
||||
case 'tid':
|
||||
return $context->data->tid;
|
||||
|
||||
case 'tids':
|
||||
return $context->argument;
|
||||
|
||||
case 'name':
|
||||
return $context->data->name;
|
||||
|
||||
case 'name_dashed':
|
||||
return drupal_strtolower(str_replace(' ', '-', $context->data->name));
|
||||
|
||||
case 'names':
|
||||
case 'names_dashed':
|
||||
// We only run this query if this item was requested:
|
||||
@@ -92,6 +94,7 @@ function ctools_context_terms_convert($context, $type) {
|
||||
}
|
||||
}
|
||||
return $context->names;
|
||||
|
||||
case 'vid':
|
||||
return $context->data->vid;
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Provide a global context to allow for token support.
|
||||
* Provide a global context to allow for token support.
|
||||
*/
|
||||
|
||||
$plugin = array(
|
||||
@@ -17,6 +17,16 @@ $plugin = array(
|
||||
|
||||
/**
|
||||
* Create a context from manual configuration.
|
||||
*
|
||||
* @param $empty
|
||||
* Unused.
|
||||
* @param $data
|
||||
* Unused.
|
||||
* @param $conf
|
||||
* Unused.
|
||||
*
|
||||
* @return ctools_context
|
||||
* A context of type token, with the plugin set appropriately.
|
||||
*/
|
||||
function ctools_context_create_token($empty, $data = NULL, $conf = FALSE) {
|
||||
$context = new ctools_context('token');
|
||||
@@ -27,9 +37,14 @@ function ctools_context_create_token($empty, $data = NULL, $conf = FALSE) {
|
||||
|
||||
/**
|
||||
* Implementation of hook_ctools_context_convert_list().
|
||||
*
|
||||
* @return array|null
|
||||
* An array of token type information, keyed by 'type:id', or NULL if
|
||||
* none found.
|
||||
*/
|
||||
function ctools_context_token_convert_list() {
|
||||
$tokens = token_info();
|
||||
// Initialise $list here?
|
||||
foreach ($tokens['types'] as $type => $type_info) {
|
||||
if (empty($type_info['needs-data'])) {
|
||||
$real_type = isset($type_info['type']) ? $type_info['type'] : $type;
|
||||
@@ -46,7 +61,17 @@ function ctools_context_token_convert_list() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_ctools_context_converter_alter().
|
||||
* Token conversion function: look up the token and return it's value.
|
||||
*
|
||||
* @param $context
|
||||
* Unused.
|
||||
* @param string $token
|
||||
* The name of the token.
|
||||
*
|
||||
* @return array|null
|
||||
* The token value, or NULL if not found.
|
||||
*
|
||||
* @see ctools_context_convert_context()
|
||||
*/
|
||||
function ctools_context_token_convert($context, $token) {
|
||||
$tokens = token_info();
|
||||
@@ -59,4 +84,5 @@ function ctools_context_token_convert($context, $token) {
|
||||
return $values[$token];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@@ -2,8 +2,7 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Plugin to provide a user context
|
||||
* Plugin to provide a user context.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -118,7 +117,7 @@ function ctools_context_user_settings_form_validate($form, &$form_state) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Validate the autocomplete
|
||||
// Validate the autocomplete.
|
||||
if (empty($form_state['values']['uid']) && empty($form_state['values']['user'])) {
|
||||
form_error($form['user'], t('You must select a user.'));
|
||||
return;
|
||||
@@ -153,6 +152,7 @@ function ctools_context_user_settings_form_submit($form, &$form_state) {
|
||||
*/
|
||||
function ctools_context_user_convert_list() {
|
||||
$tokens = token_info();
|
||||
$list = array();
|
||||
foreach ($tokens['tokens']['user'] as $id => $info) {
|
||||
if (!isset($list[$id])) {
|
||||
$list[$id] = $info['name'];
|
||||
|
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Plugin to provide a user_edit_form context
|
||||
* Plugin to provide a user_edit_form context.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -81,7 +81,7 @@ function ctools_context_create_user_edit_form($empty, $user = 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 = $user;
|
||||
$context->title = isset($user->name) ? $user->name : '';
|
||||
$context->argument = $user->uid;
|
||||
@@ -133,7 +133,7 @@ function ctools_context_user_edit_form_settings_form($form, &$form_state) {
|
||||
* Validate a node.
|
||||
*/
|
||||
function ctools_context_user_edit_form_settings_form_validate($form, &$form_state) {
|
||||
// Validate the autocomplete
|
||||
// Validate the autocomplete.
|
||||
if (empty($form_state['values']['uid']) && empty($form_state['values']['user'])) {
|
||||
form_error($form['user'], t('You must select a user.'));
|
||||
return;
|
||||
@@ -162,6 +162,7 @@ function ctools_context_user_edit_form_settings_form_validate($form, &$form_stat
|
||||
|
||||
form_set_value($form['uid'], $user->uid, $form_state);
|
||||
}
|
||||
|
||||
function ctools_context_user_edit_form_settings_form_submit($form, &$form_state) {
|
||||
if ($form_state['values']['set_identifier']) {
|
||||
$user = user_load($form_state['values']['uid']);
|
||||
|
@@ -2,8 +2,7 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Plugin to provide a vocabulary context
|
||||
* Plugin to provide a vocabulary context.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user