Projet

Général

Profil

Révision c304a780

Ajouté par Assos Assos il y a environ 6 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/ctools/plugins/contexts/node_edit_form.inc
2 2

  
3 3
/**
4 4
 * @file
5
 *
6
 * Plugin to provide a node_edit_form context
5
 * Plugin to provide a node_edit_form context.
7 6
 */
8 7

  
9 8
/**
......
32 31
 */
33 32
function ctools_context_create_node_edit_form($empty, $node = NULL, $conf = FALSE) {
34 33
  static $creating = FALSE;
35
  $context = new ctools_context(array('form', 'node_edit', 'node_form',  'node_edit_form', 'node', 'entity:node'));
34
  $context = new ctools_context(array('form', 'node_edit', 'node_form', 'node_edit_form', 'node', 'entity:node'));
36 35
  $context->plugin = 'node_edit_form';
37 36

  
38 37
  if ($empty || ($creating)) {
......
69 68

  
70 69
    $form = drupal_build_form($form_id, $form_state);
71 70

  
72
    // Fill in the 'node' portion of the context
71
    // Fill in the 'node' portion of the context.
73 72
    $context->data     = $node;
74 73
    $context->title    = isset($node->title) ? $node->title : '';
75 74
    $context->argument = isset($node->nid) ? $node->nid : $node->type;
......
126 125
 * Validate a node.
127 126
 */
128 127
function ctools_context_node_edit_form_settings_form_validate($form, &$form_state) {
129
  // Validate the autocomplete
128
  // Validate the autocomplete.
130 129
  if (empty($form_state['values']['nid']) && empty($form_state['values']['node'])) {
131 130
    form_error($form['node'], t('You must select a node.'));
132 131
    return;
......
153 152
    $node = db_query('SELECT nid, status FROM {node} WHERE LOWER(title) = LOWER(:title)', array(':title' => $nid))->fetchObject();
154 153
  }
155 154

  
156
  // Do not allow unpublished nodes to be selected by unprivileged users
155
  // Do not allow unpublished nodes to be selected by unprivileged users.
157 156
  if (!$node || (empty($node->status) && !(user_access('administer nodes')))) {
158 157
    form_error($form['node'], t('Invalid node selected.'));
159 158
  }

Formats disponibles : Unified diff