public function MiconIconize::render in Micon 8
Same name and namespace in other branches
- 2.x src/MiconIconize.php \Drupal\micon\MiconIconize::render()
Renders the object as a string.
Return value
string The translated string.
Overrides TranslatableMarkup::render
File
- src/
MiconIconize.php, line 99
Class
- MiconIconize
- Class MiconIconize.
Namespace
Drupal\miconCode
public function render() {
$return = $this
->getTitle();
$icon = $this
->getIcon();
if ($icon) {
if (!$return) {
$output = [
'#theme' => 'micon_icon',
'#icon' => $icon,
];
}
else {
$output = [
'#theme' => 'micon',
'#icon' => $icon,
'#title' => Markup::create($return),
'#icon_only' => $this->display['iconOnly'],
'#position' => $this->display['iconPosition'],
];
}
return $this->renderer
->render($output);
}
return $return;
}