diff --git a/core/lib/Drupal/Core/Layout/LayoutDefinition.php b/core/lib/Drupal/Core/Layout/LayoutDefinition.php index a9fe407e83..e3d0488929 100644 --- a/core/lib/Drupal/Core/Layout/LayoutDefinition.php +++ b/core/lib/Drupal/Core/Layout/LayoutDefinition.php @@ -181,13 +181,13 @@ public function set($property, $value) { * The human-readable name of the layout definition. */ public function getLabel() { - return new TranslatableMarkup($this->label); + return $this->label instanceof TranslatableMarkup ? $this->label : new TranslatableMarkup($this->label); } /** * Sets the human-readable name of the layout definition. * - * @param \Drupal\Core\StringTranslation\TranslatableMarkup $label + * @param string|\Drupal\Core\StringTranslation\TranslatableMarkup $label * The human-readable name of the layout definition. * * @return $this @@ -204,7 +204,7 @@ public function setLabel($label) { * The description of the layout definition. */ public function getDescription() { - return new TranslatableMarkup($this->description); + return $this->description instanceof TranslatableMarkup ? $this->description : new TranslatableMarkup($this->description); } /** @@ -227,7 +227,7 @@ public function setDescription($description) { * The human-readable category of the layout definition. */ public function getCategory() { - return new TranslatableMarkup($this->category); + return $this->category instanceof TranslatableMarkup ? $this->category : new TranslatableMarkup($this->category); } /**