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/access/entity_field_value.inc
48 48
}
49 49

  
50 50
function _ctools_entity_field_value_ctools_access_get_child($plugin, $parent, $entity_type, $bundle_type, $field_name, $entity = NULL, $bundle = NULL, $field = NULL) {
51
  // check that the entity, bundle and field arrays have a value.
51
  // Check that the entity, bundle and field arrays have a value.
52 52
  // If not, load theme using machine names.
53 53
  if (empty($entity)) {
54 54
    $entity = entity_get_info($entity_type);
......
68 68
  $plugin['description'] = t('Control access by @entity entity bundle.', array('@entity' => $entity_type));
69 69
  $plugin['name'] = $parent . ':' . $entity_type . ':' . $bundle_type . ':' . $field_name;
70 70
  $plugin['required context'] = new ctools_context_required(t(ucfirst($entity_type)), $entity_type, array(
71
      'type' => $bundle_type,
72
    ));
71
    'type' => $bundle_type,
72
  ));
73 73

  
74 74
  return $plugin;
75 75
}
76 76

  
77 77
/**
78
 * Settings form for the 'by entity_bundle' access plugin
78
 * Settings form for the 'by entity_bundle' access plugin.
79 79
 */
80 80
function ctools_entity_field_value_ctools_access_settings($form, &$form_state, $conf) {
81 81
  $plugin = $form_state['plugin'];
......
88 88
    $columns[$column] = _field_sql_storage_columnname($field_name, $column);
89 89
  }
90 90
  ctools_include('fields');
91
  $entity = (object)array(
91
  $entity = (object) array(
92 92
    $entity_info['entity keys']['bundle'] => $bundle_type,
93 93
  );
94 94

  
......
115 115
  $form['#parents'] = array('settings');
116 116
  $langcode = field_valid_language(NULL);
117 117
  $form['settings'] += (array) ctools_field_invoke_field($instance, 'form', $entity_type, $entity, $form, $form_state, array('default' => TRUE, 'language' => $langcode));
118
  // weight is really not important once this is populated and will only interfere with the form layout.
118
  // Weight is really not important once this is populated and will only interfere with the form layout.
119 119
  foreach (element_children($form['settings']) as $element) {
120 120
    unset($form['settings'][$element]['#weight']);
121 121
  }
......
145 145
function _ctools_entity_field_value_get_proper_form_items($field, $form_items, $columns) {
146 146
  $items = array();
147 147

  
148
  if (!is_array($form_items)) { // Single value item.
148
  // Single value item.
149
  if (!is_array($form_items)) {
149 150
    foreach ($columns as $column) {
150 151
      $items[0][$column] = $form_items;
151 152
    }
......
175 176
  foreach ($columns as $column) {
176 177
    if (isset($form_items[$column])) {
177 178
      $has_columns = TRUE;
178
      $item[$column] =  $form_items[$column];
179
      $item[$column] = $form_items[$column];
179 180
    }
180 181
    else {
181 182
      $item[$column] = '';
......
353 354
        $display['type'] = 'entityreference_label';
354 355
        break;
355 356

  
356
      default :
357
      default:
357 358
        // Use field instance formatter setting.
358 359
        break;
359 360
    }
......
381 382
    if (is_array($elements)) {
382 383
      foreach ($elements as $element_key => $element) {
383 384
        if (is_numeric($element_key)) {
384
          $value_str= strip_tags(drupal_render($element));
385
          $value_str = strip_tags(drupal_render($element));
385 386
          if (strlen($value_str) > 0) {
386 387
            $output[] = $value_str;
387 388
          }

Formats disponibles : Unified diff