You are here

public function Element::setProperty in Express 8

Sets the value for a property.

Parameters

string $name: The name of the property to set.

mixed $value: The value of the property to set.

bool $recurse: Flag indicating wither to set the same property on child elements.

Return value

$this

2 calls to Element::setProperty()
Element::setIcon in themes/contrib/bootstrap/src/Utility/Element.php
Adds an icon to button element based on its text value.
Element::smartDescription in themes/contrib/bootstrap/src/Utility/Element.php
Converts an element description into a tooltip based on certain criteria.

File

themes/contrib/bootstrap/src/Utility/Element.php, line 679
Contains \Drupal\bootstrap\Utility\Element.

Class

Element
Provides helper methods for Drupal render elements.

Namespace

Drupal\bootstrap\Utility

Code

public function setProperty($name, $value, $recurse = FALSE) {
  $this->array["#{$name}"] = $value instanceof Element ? $value
    ->getArray() : $value;
  if ($recurse) {
    foreach ($this
      ->children() as $child) {
      $child
        ->setProperty($name, $value, $recurse);
    }
  }
  return $this;
}