예제 #1
0
파일: Map.php 프로젝트: papillon-cendre/d8
 /**
  * Writes the value of a property without handling changes.
  *
  * Implementations of onChange() should use this method instead of set() in
  * order to avoid onChange() being triggered again.
  *
  * @param string $property_name
  *   The name of the property to be written.
  * @param $value
  *   The value to set.
  */
 protected function writePropertyValue($property_name, $value)
 {
     if ($this->definition->getPropertyDefinition($property_name)) {
         $this->get($property_name)->setValue($value, FALSE);
     } else {
         // Just set the plain value, which allows adding a new entry to the map.
         $this->values[$property_name] = $value;
     }
 }
예제 #2
0
 /**
  * Implements \Drupal\Core\TypedData\ComplexDataInterface::set().
  */
 public function set($property_name, $value, $notify = TRUE)
 {
     if ($this->definition->getPropertyDefinition($property_name)) {
         $this->get($property_name)->setValue($value, $notify);
     } else {
         // Just set the plain value, which allows adding a new entry to the map.
         $this->values[$property_name] = $value;
         // Directly notify ourselves.
         if ($notify) {
             $this->onChange($property_name, $value);
         }
     }
 }