Projet

Général

Profil

Révision 96a203dd

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/plugins/relationships/entity_from_field.inc
154 154
 * Return a new context based on an existing context.
155 155
 */
156 156
function ctools_entity_from_field_context($context, $conf) {
157
  // Perform access check on current logged in user.
158
  global $user;
159
  // Clone user object so account can be passed by value to access callback.
160
  $account = clone $user;
161

  
157 162
  $delta = !empty($conf['delta']) ? intval($conf['delta']) : 0;
158 163
  $plugin = $conf['name'];
159 164
  list($plugin, $plugin_name) = explode(':', $plugin);
......
176 181

  
177 182
        $plugin_info = ctools_get_relationship($conf['name']);
178 183
        $to_entity_id = $items[$delta][$plugin_info['source key']];
179
        $loaded_to_entity = array_shift(entity_load($to_entity, array($to_entity_id)));
180
        if(function_exists($to_entity_info['access callback']) && !call_user_func($to_entity_info['access callback'], 'view', $loaded_to_entity)) {
184
        $loaded_to_entity = entity_load($to_entity, array($to_entity_id));
185
        $loaded_to_entity = array_shift($loaded_to_entity);
186

  
187
        // Pass current user account and entity type to access callback.
188
        if (function_exists($to_entity_info['access callback']) && !call_user_func($to_entity_info['access callback'], 'view', $loaded_to_entity, $account, $to_entity)) {
181 189
          return ctools_context_create_empty('entity:' . $to_entity, NULL);
182 190
        }
183 191
        else {

Formats disponibles : Unified diff