public function Element::setIcon in Express 8
Adds an icon to button element based on its text value.
Parameters
array $icon: An icon render array.
Return value
$this
See also
\Drupal\bootstrap\Bootstrap::glyphicon()
File
- themes/
contrib/ bootstrap/ src/ Utility/ Element.php, line 656 - Contains \Drupal\bootstrap\Utility\Element.
Class
- Element
- Provides helper methods for Drupal render elements.
Namespace
Drupal\bootstrap\UtilityCode
public function setIcon(array $icon = NULL) {
if ($this
->isButton() && !Bootstrap::getTheme()
->getSetting('button_iconize')) {
return $this;
}
if ($value = $this
->getProperty('value', $this
->getProperty('title'))) {
$icon = isset($icon) ? $icon : Bootstrap::glyphiconFromString($value);
$this
->setProperty('icon', $icon);
}
return $this;
}