Projet

Général

Profil

Révision e4c061ad

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

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/ctools/includes/content.menu.inc
27 27
  if ($string != '') {
28 28
    global $user;
29 29
    $entity_info = entity_get_info($type);
30
    if ($type == 'node') {
31
      $entity_info['entity keys']['bundle field'] = 'type';
32
    }
30 33

  
31 34
    // We must query all ids, because if every one of the 10 don't have access
32 35
    // the user may never be able to autocomplete a node title.
......
56 59
      }
57 60
      else {
58 61
        $matches[$result['label'] . " [id: $entity_id]"] = '<span class="autocomplete_title">' . check_plain($result['label']) . '</span>';
62
        $matches[$result['label'] . " [id: $entity_id]"] .= isset($result['bundle field']) ? ' <span class="autocomplete_bundle">(' . check_plain($result['bundle field']) . ')</span>' : '';
59 63
      }
60 64
    }
61 65

  
......
83 87
      $query->fields($base_table, array($entity_info['entity keys']['label']));
84 88
    }
85 89

  
90
    // Add bundle field to the query, if it exists.
91
    if (isset($entity_info['entity keys']['bundle field'])) {
92
      $query->fields($base_table, array($entity_info['entity keys']['bundle field']));
93
    }
94

  
86 95
    // Add a generic entity access tag to the query.
87 96
    $query->addTag('ctools');
88 97

  
......
131 140
    foreach ($results as $record) {
132 141
      $options[$record->{$entity_info['entity keys']['id']}] = array(
133 142
        'label' => isset($entity_info['entity keys']['label']) ? check_plain($record->{$entity_info['entity keys']['label']}) : $record->{$entity_info['entity keys']['id']},
143
        'bundle field' => isset($entity_info['entity keys']['bundle field']) ? check_plain($record->{$entity_info['entity keys']['bundle field']}) : '',
134 144
      );
135 145
    }
136 146
  }

Formats disponibles : Unified diff