diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php index c8b9eda..55e8728 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php @@ -74,24 +74,16 @@ public function isNew() { } /** - * Overrides Entity::get(). - * - * EntityInterface::get() implements support for fieldable entities, but - * configuration entities are not fieldable. + * {@inheritdoc} */ - public function get($property_name, $langcode = NULL) { - // @todo: Add support for translatable properties being not fields. + public function get($property_name) { return isset($this->{$property_name}) ? $this->{$property_name} : NULL; } /** - * Overrides Entity::set(). - * - * EntityInterface::set() implements support for fieldable entities, but - * configuration entities are not fieldable. + * {@inheritdoc} */ - public function set($property_name, $value, $langcode = NULL, $notify = TRUE) { - // @todo: Add support for translatable properties being not fields. + public function set($property_name, $value) { $this->{$property_name} = $value; } @@ -149,7 +141,7 @@ public static function sort($a, $b) { } /** - * Overrides \Drupal\Core\Entity\Entity::getExportProperties(). + * {@inheritdoc} */ public function getExportProperties() { // Configuration objects do not have a schema. Extract all key names from diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityInterface.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityInterface.php index 0d9bd71..d1adc69 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityInterface.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityInterface.php @@ -76,6 +76,27 @@ public function setStatus($status); public function status(); /** + * Returns the value of a property. + * + * @param string $property_name + * The name of the property that should be returned. + * + * @return mixed + * The property, if existing, NULL otherwise. + */ + public function get($property_name); + + /** + * Sets the value of a property. + * + * @param string $property_name + * The name of the property that should be set. + * @param mixed $value + * The value the property should be set to. + */ + public function set($property_name, $value); + + /** * Retrieves the exportable properties of the entity. * * These are the values that get saved into config. diff --git a/core/lib/Drupal/Core/Entity/ContentEntityBase.php b/core/lib/Drupal/Core/Entity/ContentEntityBase.php index ec74ed7..06cea33 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityBase.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityBase.php @@ -181,6 +181,17 @@ public function isNewRevision() { /** * {@inheritdoc} */ + public function isDefaultRevision($new_value = NULL) { + $return = $this->isDefaultRevision; + if (isset($new_value)) { + $this->isDefaultRevision = (bool) $new_value; + } + return $return; + } + + /** + * {@inheritdoc} + */ public function getRevisionId() { return NULL; } diff --git a/core/lib/Drupal/Core/Entity/ContentEntityFormController.php b/core/lib/Drupal/Core/Entity/ContentEntityFormController.php index 60a110c..c12683b 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityFormController.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityFormController.php @@ -54,9 +54,9 @@ public function validate(array $form, array &$form_state) { if ($violations) { foreach ($violations as $field_name => $field_violations) { $langcode = field_is_translatable($entity_type, field_info_field($entity_type, $field_name)) ? $entity_langcode : Language::LANGCODE_NOT_SPECIFIED; - $field_state = field_form_get_state($form['#parents'], $field_name, $langcode, $form_state); + $field_state = field_form_get_state($form['#parents'], $field_name, $form_state); $field_state['constraint_violations'] = $field_violations; - field_form_set_state($form['#parents'], $field_name, $langcode, $form_state, $field_state); + field_form_set_state($form['#parents'], $field_name, $form_state, $field_state); } field_invoke_method('flagErrors', _field_invoke_widget_target($form_state['form_display']), $entity, $form, $form_state); diff --git a/core/lib/Drupal/Core/Entity/Entity.php b/core/lib/Drupal/Core/Entity/Entity.php index 51ae0f1..7c9fb65 100644 --- a/core/lib/Drupal/Core/Entity/Entity.php +++ b/core/lib/Drupal/Core/Entity/Entity.php @@ -55,49 +55,49 @@ public function __construct(array $values, $entity_type) { } /** - * Implements \Drupal\Core\Entity\EntityInterface::id(). + * {@inheritdoc} */ public function id() { return isset($this->id) ? $this->id : NULL; } /** - * Implements \Drupal\Core\Entity\EntityInterface::uuid(). + * {@inheritdoc} */ public function uuid() { return isset($this->uuid) ? $this->uuid : NULL; } /** - * Implements \Drupal\Core\Entity\EntityInterface::isNew(). + * {@inheritdoc} */ public function isNew() { return !empty($this->enforceIsNew) || !$this->id(); } /** - * Implements \Drupal\Core\Entity\EntityInterface::enforceIsNew(). + * {@inheritdoc} */ public function enforceIsNew($value = TRUE) { $this->enforceIsNew = $value; } /** - * Implements \Drupal\Core\Entity\EntityInterface::entityType(). + * {@inheritdoc} */ public function entityType() { return $this->entityType; } /** - * Implements \Drupal\Core\Entity\EntityInterface::bundle(). + * {@inheritdoc} */ public function bundle() { return $this->entityType; } /** - * Implements \Drupal\Core\Entity\EntityInterface::label(). + * {@inheritdoc} */ public function label($langcode = NULL) { $label = NULL; @@ -112,7 +112,7 @@ public function label($langcode = NULL) { } /** - * Implements \Drupal\Core\Entity\EntityInterface::uri(). + * {@inheritdoc} */ public function uri() { $bundle = $this->bundle(); @@ -157,27 +157,9 @@ public function uriRelationships() { return isset($entity_info['links']) ? array_keys($entity_info['links']) : array(); } - /** - * Implements \Drupal\Core\Entity\EntityInterface::get(). - */ - public function get($property_name) { - // @todo: Replace by EntityNG implementation once all entity types have been - // converted to use the entity field API. - return isset($this->{$property_name}) ? $this->{$property_name} : NULL; - } - - /** - * Implements \Drupal\Core\TypedData\ComplexDataInterface::set(). - */ - public function set($property_name, $value, $notify = TRUE) { - // @todo: Replace by EntityNG implementation once all entity types have been - // converted to use the entity field API. - $this->{$property_name} = $value; - } - /** - * Implements \Drupal\Core\TypedData\AccessibleInterface::access(). + * {@inheritdoc} */ public function access($operation = 'view', AccountInterface $account = NULL) { if ($operation == 'create') { @@ -203,14 +185,14 @@ public function language() { } /** - * Implements \Drupal\Core\Entity\EntityInterface::save(). + * {@inheritdoc} */ public function save() { return \Drupal::entityManager()->getStorageController($this->entityType)->save($this); } /** - * Implements \Drupal\Core\Entity\EntityInterface::delete(). + * {@inheritdoc} */ public function delete() { if (!$this->isNew()) { @@ -219,7 +201,7 @@ public function delete() { } /** - * Implements \Drupal\Core\Entity\EntityInterface::createDuplicate(). + * {@inheritdoc} */ public function createDuplicate() { $duplicate = clone $this; @@ -235,24 +217,13 @@ public function createDuplicate() { } /** - * Implements \Drupal\Core\Entity\EntityInterface::entityInfo(). + * {@inheritdoc} */ public function entityInfo() { return \Drupal::entityManager()->getDefinition($this->entityType()); } /** - * Implements \Drupal\Core\Entity\EntityInterface::isDefaultRevision(). - */ - public function isDefaultRevision($new_value = NULL) { - $return = $this->isDefaultRevision; - if (isset($new_value)) { - $this->isDefaultRevision = (bool) $new_value; - } - return $return; - } - - /** * {@inheritdoc} */ public function preSave(EntityStorageControllerInterface $storage_controller) { diff --git a/core/modules/block/lib/Drupal/block/Entity/Block.php b/core/modules/block/lib/Drupal/block/Entity/Block.php index e465455..3aa5448 100644 --- a/core/modules/block/lib/Drupal/block/Entity/Block.php +++ b/core/modules/block/lib/Drupal/block/Entity/Block.php @@ -135,11 +135,11 @@ public function label($langcode = NULL) { } /** - * Overrides \Drupal\Core\Config\Entity\ConfigEntityBase::get(); + * {@inheritdoc} */ - public function get($property_name, $langcode = NULL) { + public function get($property_name) { // The theme is stored in the entity ID. - $value = parent::get($property_name, $langcode); + $value = parent::get($property_name); if ($property_name == 'theme' && !$value) { list($value) = explode('.', $this->id()); }