Projet

Général

Profil

Révision 7d7b5830

Ajouté par Assos Assos il y a environ 9 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/entity/includes/entity.inc
31 31
  protected $entityInfo;
32 32
  protected $idKey, $nameKey, $statusKey;
33 33
  protected $defaultLabel = FALSE;
34
  protected $wrapper;
34 35

  
35 36
  /**
36 37
   * Creates a new entity.
......
111 112
    return !empty($this->entityInfo['entity keys']['bundle']) ? $this->{$this->entityInfo['entity keys']['bundle']} : $this->entityType;
112 113
  }
113 114

  
115
  /**
116
   * Returns the EntityMetadataWrapper of the entity.
117
   *
118
   * @return EntityDrupalWrapper
119
   *   An EntityMetadataWrapper containing the entity.
120
   */
121
  public function wrapper() {
122
    if (empty($this->wrapper)) {
123
      $this->wrapper = entity_metadata_wrapper($this->entityType, $this);
124
    }
125
    elseif ($this->wrapper->value() !== $this) {
126
      // Wrapper has been modified outside, so let's better create a new one.
127
      $this->wrapper = entity_metadata_wrapper($this->entityType, $this);
128
    }
129
    return $this->wrapper;
130
  }
131

  
114 132
  /**
115 133
   * Returns the label of the entity.
116 134
   *

Formats disponibles : Unified diff