Chris@0: $value) { Chris@0: $this->set($property, $value); Chris@0: } Chris@0: } Chris@0: Chris@0: /** Chris@0: * Gets any arbitrary property. Chris@0: * Chris@0: * @param string $property Chris@0: * The property to retrieve. Chris@0: * Chris@0: * @return mixed Chris@0: * The value for that property, or NULL if the property does not exist. Chris@0: */ Chris@0: public function get($property) { Chris@0: if (property_exists($this, $property)) { Chris@0: $value = isset($this->{$property}) ? $this->{$property} : NULL; Chris@0: } Chris@0: else { Chris@0: $value = isset($this->additional[$property]) ? $this->additional[$property] : NULL; Chris@0: } Chris@0: return $value; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Sets a value to an arbitrary property. Chris@0: * Chris@0: * @param string $property Chris@0: * The property to use for the value. Chris@0: * @param mixed $value Chris@0: * The value to set. Chris@0: * Chris@0: * @return $this Chris@0: */ Chris@0: public function set($property, $value) { Chris@0: if (property_exists($this, $property)) { Chris@0: $this->{$property} = $value; Chris@0: } Chris@0: else { Chris@0: $this->additional[$property] = $value; Chris@0: } Chris@0: return $this; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Gets the human-readable name of the layout definition. Chris@0: * Chris@0: * @return string|\Drupal\Core\StringTranslation\TranslatableMarkup Chris@0: * The human-readable name of the layout definition. Chris@0: */ Chris@0: public function getLabel() { Chris@0: return $this->label; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Sets the human-readable name of the layout definition. Chris@0: * Chris@0: * @param string|\Drupal\Core\StringTranslation\TranslatableMarkup $label Chris@0: * The human-readable name of the layout definition. Chris@0: * Chris@0: * @return $this Chris@0: */ Chris@0: public function setLabel($label) { Chris@0: $this->label = $label; Chris@0: return $this; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Gets the description of the layout definition. Chris@0: * Chris@0: * @return string|\Drupal\Core\StringTranslation\TranslatableMarkup Chris@0: * The description of the layout definition. Chris@0: */ Chris@0: public function getDescription() { Chris@0: return $this->description; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Sets the description of the layout definition. Chris@0: * Chris@0: * @param string|\Drupal\Core\StringTranslation\TranslatableMarkup $description Chris@0: * The description of the layout definition. Chris@0: * Chris@0: * @return $this Chris@0: */ Chris@0: public function setDescription($description) { Chris@0: $this->description = $description; Chris@0: return $this; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Gets the human-readable category of the layout definition. Chris@0: * Chris@0: * @return string|\Drupal\Core\StringTranslation\TranslatableMarkup Chris@0: * The human-readable category of the layout definition. Chris@0: */ Chris@0: public function getCategory() { Chris@0: return $this->category; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Sets the human-readable category of the layout definition. Chris@0: * Chris@0: * @param string|\Drupal\Core\StringTranslation\TranslatableMarkup $category Chris@0: * The human-readable category of the layout definition. Chris@0: * Chris@0: * @return $this Chris@0: */ Chris@0: public function setCategory($category) { Chris@0: $this->category = $category; Chris@0: return $this; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Gets the template name. Chris@0: * Chris@0: * @return string|null Chris@0: * The template name, if it exists. Chris@0: */ Chris@0: public function getTemplate() { Chris@0: return $this->template; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Sets the template name. Chris@0: * Chris@0: * @param string|null $template Chris@0: * The template name. Chris@0: * Chris@0: * @return $this Chris@0: */ Chris@0: public function setTemplate($template) { Chris@0: $this->template = $template; Chris@0: return $this; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Gets the template path. Chris@0: * Chris@0: * @return string Chris@0: * The template path. Chris@0: */ Chris@0: public function getTemplatePath() { Chris@0: return $this->templatePath; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Sets the template path. Chris@0: * Chris@0: * @param string $template_path Chris@0: * The template path. Chris@0: * Chris@0: * @return $this Chris@0: */ Chris@0: public function setTemplatePath($template_path) { Chris@0: $this->templatePath = $template_path; Chris@0: return $this; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Gets the theme hook. Chris@0: * Chris@0: * @return string|null Chris@0: * The theme hook, if it exists. Chris@0: */ Chris@0: public function getThemeHook() { Chris@0: return $this->theme_hook; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Sets the theme hook. Chris@0: * Chris@0: * @param string $theme_hook Chris@0: * The theme hook. Chris@0: * Chris@0: * @return $this Chris@0: */ Chris@0: public function setThemeHook($theme_hook) { Chris@0: $this->theme_hook = $theme_hook; Chris@0: return $this; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Gets the base path for this layout definition. Chris@0: * Chris@0: * @return string Chris@0: * The base path. Chris@0: */ Chris@0: public function getPath() { Chris@0: return $this->path; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Sets the base path for this layout definition. Chris@0: * Chris@0: * @param string $path Chris@0: * The base path. Chris@0: * Chris@0: * @return $this Chris@0: */ Chris@0: public function setPath($path) { Chris@0: $this->path = $path; Chris@0: return $this; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Gets the asset library for this layout definition. Chris@0: * Chris@0: * @return string|null Chris@0: * The asset library, if it exists. Chris@0: */ Chris@0: public function getLibrary() { Chris@0: return $this->library; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Sets the asset library for this layout definition. Chris@0: * Chris@0: * @param string|null $library Chris@0: * The asset library. Chris@0: * Chris@0: * @return $this Chris@0: */ Chris@0: public function setLibrary($library) { Chris@0: $this->library = $library; Chris@0: return $this; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Gets the icon path for this layout definition. Chris@0: * Chris@0: * @return string|null Chris@0: * The icon path, if it exists. Chris@0: */ Chris@0: public function getIconPath() { Chris@0: return $this->icon; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Sets the icon path for this layout definition. Chris@0: * Chris@0: * @param string|null $icon Chris@0: * The icon path. Chris@0: * Chris@0: * @return $this Chris@0: */ Chris@0: public function setIconPath($icon) { Chris@0: $this->icon = $icon; Chris@0: return $this; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Gets the regions for this layout definition. Chris@0: * Chris@0: * @return array[] Chris@0: * The layout regions. The keys of the array are the machine names of the Chris@0: * regions, and the values are an associative array with the following keys: Chris@0: * - label: (string) The human-readable name of the region. Chris@0: * Any remaining keys may have special meaning for the given layout plugin, Chris@0: * but are undefined here. Chris@0: */ Chris@0: public function getRegions() { Chris@0: return $this->regions; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Sets the regions for this layout definition. Chris@0: * Chris@0: * @param array[] $regions Chris@0: * An array of regions, see ::getRegions() for the format. Chris@0: * Chris@0: * @return $this Chris@0: */ Chris@0: public function setRegions(array $regions) { Chris@0: $this->regions = $regions; Chris@0: return $this; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Gets the machine-readable region names. Chris@0: * Chris@0: * @return string[] Chris@0: * An array of machine-readable region names. Chris@0: */ Chris@0: public function getRegionNames() { Chris@0: return array_keys($this->getRegions()); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Gets the human-readable region labels. Chris@0: * Chris@0: * @return string[] Chris@0: * An array of human-readable region labels. Chris@0: */ Chris@0: public function getRegionLabels() { Chris@0: $regions = $this->getRegions(); Chris@0: return array_combine(array_keys($regions), array_column($regions, 'label')); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Gets the default region. Chris@0: * Chris@0: * @return string Chris@0: * The machine-readable name of the default region. Chris@0: */ Chris@0: public function getDefaultRegion() { Chris@0: return $this->default_region; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Sets the default region. Chris@0: * Chris@0: * @param string $default_region Chris@0: * The machine-readable name of the default region. Chris@0: * Chris@0: * @return $this Chris@0: */ Chris@0: public function setDefaultRegion($default_region) { Chris@0: $this->default_region = $default_region; Chris@0: return $this; Chris@0: } Chris@0: Chris@0: /** Chris@0: * {@inheritdoc} Chris@0: */ Chris@0: public function getDeriver() { Chris@0: return $this->deriver; Chris@0: } Chris@0: Chris@0: /** Chris@0: * {@inheritdoc} Chris@0: */ Chris@0: public function setDeriver($deriver) { Chris@0: $this->deriver = $deriver; Chris@0: return $this; Chris@0: } Chris@0: Chris@0: }