Projet

Général

Profil

Révision 7e72b748

Ajouté par Assos Assos il y a plus de 6 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/ctools/includes/fields.inc
5 5
 * Extend core fields with some helper functions to reduce code complexity within views and ctools plugins.
6 6
 */
7 7

  
8

  
9 8
/**
10 9
 * Fake an instance of a field.
11 10
 *
......
75 74
    $conf['formatter_settings'] += $formatter['settings'];
76 75
  }
77 76
  $function = $formatter['module'] . '_field_formatter_settings_form';
77

  
78
  $instance = ctools_fields_fake_field_instance($field['field_name'], $view_mode, $formatter_type, $conf['formatter_settings']);
78 79
  if (function_exists($function)) {
79
    $instance = ctools_fields_fake_field_instance($field['field_name'], $view_mode, $formatter_type, $conf['formatter_settings']);
80 80
    $settings_form = $function($field, $instance, $view_mode, $form, $form_state);
81
    if ($settings_form) {
82
      // Allow other modules to alter the formatter settings form.
83
      $context = array(
84
        'module' => $formatter['module'],
85
        'formatter' => $formatter,
86
        'field' => $field,
87
        'instance' => $instance,
88
        'view_mode' => $view_mode,
89
        'form' => $form,
90
        'form_state' => $form_state,
91
      );
92
      drupal_alter('field_formatter_settings_form', $settings_form, $context);
93

  
94
      $settings_form['#tree'] = TRUE;
95
      $form['ctools_field_list']['#value'][] = $field;
96
      $form += $settings_form;
97
    }
98 81
  }
82
  if (empty($settings_form)) {
83
    $settings_form = array();
84
  }
85

  
86
  // Allow other modules to alter the formatter settings form.
87
  $context = array(
88
    'module' => $formatter['module'],
89
    'formatter' => $formatter,
90
    'field' => $field,
91
    'instance' => $instance,
92
    'view_mode' => $view_mode,
93
    'form' => $form,
94
    'form_state' => $form_state,
95
  );
96
  drupal_alter('field_formatter_settings_form', $settings_form, $context);
97

  
98
  $settings_form['#tree'] = TRUE;
99
  $form['ctools_field_list']['#value'][] = $field;
100
  $form += $settings_form;
99 101

  
100 102
  if (isset($field['cardinality']) && $field['cardinality'] != 1) {
101 103
    list($prefix, $suffix) = explode('@count', t('Skip the first @count item(s)'));
......
208 210
 *   - Otherwise NULL.
209 211
 * @param $options
210 212
 *   An associative array of additional options, with the following keys:
211
 *  - 'field_name': The name of the field whose operation should be
213
 *   - 'field_name': The name of the field whose operation should be
212 214
 *    invoked. By default, the operation is invoked on all the fields
213 215
 *    in the entity's bundle. NOTE: This option is not compatible with
214 216
 *    the 'deleted' option; the 'field_id' option should be used
215 217
 *    instead.
216
 *  - 'field_id': The id of the field whose operation should be
218
 *   - 'field_id': The id of the field whose operation should be
217 219
 *    invoked. By default, the operation is invoked on all the fields
218 220
 *    in the entity's' bundles.
219
 *  - 'default': A boolean value, specifying which implementation of
221
 *   - 'default': A boolean value, specifying which implementation of
220 222
 *    the operation should be invoked.
221 223
 *    - if FALSE (default), the field types implementation of the operation
222 224
 *      will be invoked (hook_field_[op])
......
224 226
 *      will be invoked (field_default_[op])
225 227
 *    Internal use only. Do not explicitely set to TRUE, but use
226 228
 *    _field_invoke_default() instead.
227
 *  - 'deleted': If TRUE, the function will operate on deleted fields
229
 *   - 'deleted': If TRUE, the function will operate on deleted fields
228 230
 *    as well as non-deleted fields. If unset or FALSE, only
229 231
 *    non-deleted fields are operated on.
230
 *  - 'language': A language code or an array of language codes keyed by field
232
 *   - 'language': A language code or an array of language codes keyed by field
231 233
 *    name. It will be used to narrow down to a single value the available
232 234
 *    languages to act on.
233 235
 *
......
340 342
      $foreign_keys[$field_name] = $field['foreign keys'];
341 343
    }
342 344
    else {
343
      // try to fetch foreign keys from schema, as not everything
345
      // Try to fetch foreign keys from schema, as not everything
344 346
      // stores foreign keys properly in the field info.
345 347
      $module = $field['module'];
346 348

  

Formats disponibles : Unified diff