From 838d7e70a5403a117cec365d4a87fad8a7eb5382 Mon Sep 17 00:00:00 2001 From: webchick <webchick@24967.no-reply.drupal.org> Date: Fri, 8 Feb 2013 21:13:32 -0800 Subject: [PATCH] Issue #1911814 by damiankloip: Add a setStatus() method for configuration entities. --- .../Drupal/Core/Config/Entity/ConfigEntityBase.php | 12 +++++++++--- .../Core/Config/Entity/ConfigEntityInterface.php | 11 +++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php index 3bbf1ed0ab4c..46f303c184a8 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php @@ -99,15 +99,21 @@ public function set($property_name, $value, $langcode = NULL) { * Implements \Drupal\Core\Config\Entity\ConfigEntityInterface::enable(). */ public function enable() { - $this->status = TRUE; - return $this; + return $this->setStatus(TRUE); } /** * Implements \Drupal\Core\Config\Entity\ConfigEntityInterface::disable(). */ public function disable() { - $this->status = FALSE; + return $this->setStatus(FALSE); + } + + /** + * Implements \Drupal\Core\Config\Entity\ConfigEntityInterface::setStatus(). + */ + public function setStatus(bool $status) { + $this->status = $status; return $this; } diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityInterface.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityInterface.php index 8df5847ae691..41c213235a52 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityInterface.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityInterface.php @@ -48,6 +48,17 @@ public function enable(); */ public function disable(); + /** + * Sets the status of the configuration entity. + * + * @param bool $status + * The status of the configuration entity. + * + * @return \Drupal\Core\Config\Entity\ConfigEntityInterface + * The class instance that this method is called on. + */ + public function setStatus(bool $status); + /** * Returns whether the configuration entity is enabled. * -- GitLab