Skip to content

Commit

Permalink
Merge pull request #159 from erkenes/master
Browse files Browse the repository at this point in the history
FEATURE: Add getProperty to FormElement & add getRenderingOption to AbstractRenderable
  • Loading branch information
bwaidelich authored Sep 13, 2022
2 parents eea3ba5 + ff02cd9 commit 6bec0fa
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Classes/Core/Model/AbstractFormElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,21 @@ public function setProperty($key, $value)
$this->properties[$key] = $value;
}

/**
* Get a property of the element
*
* @param string $key
* @return mixed
*/
public function getProperty($key)
{
if (key_exists($key, $this->properties)) {
return $this->properties[$key];
}

return null;
}

/**
* Get all properties
*
Expand Down
8 changes: 8 additions & 0 deletions Classes/Core/Model/FormElementInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ public function setDefaultValue($defaultValue);
*/
public function setProperty($key, $value);

/**
* Get a property of the element
*
* @param string $key
* @return mixed
*/
public function getProperty($key);

/**
* Get all element-specific configuration properties
*
Expand Down
16 changes: 16 additions & 0 deletions Classes/Core/Model/Renderable/AbstractRenderable.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,22 @@ public function setRenderingOption($key, $value)
$this->renderingOptions[$key] = $value;
}

/**
* Get rendering option by $key.
*
* @param string $key
* @api
* @return mixed
*/
public function getRenderingOption($key)
{
if (key_exists($key, $this->renderingOptions)) {
return $this->renderingOptions[$key];
}

return null;
}

/**
* Get the parent renderable
*
Expand Down
11 changes: 11 additions & 0 deletions Classes/Core/Model/UnknownFormElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,17 @@ public function setProperty($key, $value)
{
}

/**
* Get a property of the element
*
* @param string $key
* @return mixed
*/
public function getProperty($key)
{
return null;
}

/**
* @return array
*/
Expand Down
15 changes: 15 additions & 0 deletions Classes/FormElements/Section.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,21 @@ public function getProperties()
return $this->properties;
}

/**
* Get a property of the element
*
* @param string $key
* @return mixed
*/
public function getProperty($key)
{
if (key_exists($key, $this->properties)) {
return $this->properties[$key];
}

return null;
}

/**
* Set an element-specific configuration property.
*
Expand Down

0 comments on commit 6bec0fa

Please sign in to comment.