class Micon in Micon 8
Same name in this branch
- 8 src/TwigExtension/Micon.php \Drupal\micon\TwigExtension\Micon
- 8 src/Element/Micon.php \Drupal\micon\Element\Micon
- 8 src/Entity/Micon.php \Drupal\micon\Entity\Micon
- 8 src/Plugin/SocialMediaLinks/Iconset/Micon.php \Drupal\micon\Plugin\SocialMediaLinks\Iconset\Micon
Same name and namespace in other branches
- 2.x src/TwigExtension/Micon.php \Drupal\micon\TwigExtension\Micon
A class providing Micon Twig extensions.
This provides a Twig extension that registers the {{ micon() }} extension to Twig.
Hierarchy
- class \Drupal\micon\TwigExtension\Micon extends \Drupal\micon\TwigExtension\Twig_Extension
Expanded class hierarchy of Micon
9 string references to 'Micon'
- micon.info.yml in ./
micon.info.yml - micon.info.yml
- micon.links.menu.yml in ./
micon.links.menu.yml - micon.links.menu.yml
- micon.services.yml in ./
micon.services.yml - micon.services.yml
- micon_content_type.info.yml in micon_content_type/
micon_content_type.info.yml - micon_content_type/micon_content_type.info.yml
- micon_link.info.yml in micon_link/
micon_link.info.yml - micon_link/micon_link.info.yml
1 service uses Micon
File
- src/
TwigExtension/ Micon.php, line 11
Namespace
Drupal\micon\TwigExtensionView source
class Micon extends \Twig_Extension {
/**
* Gets a unique identifier for this Twig extension.
*
* @return string
* A unique identifier for this Twig extension.
*/
public function getName() {
return 'twig.micon';
}
/**
* {@inheritdoc}
*/
public function getFunctions() {
return array(
new \Twig_SimpleFunction('micon', array(
$this,
'renderIcon',
)),
);
}
/**
* Render the icon.
*
* @param string $icon
* The icon_id of the icon to render.
*
* @return mixed[]
* A render array.
*/
public static function renderIcon($icon) {
$build = [
'#theme' => 'micon_icon',
'#icon' => $icon,
];
return $build;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Micon:: |
public | function | ||
Micon:: |
public | function | Gets a unique identifier for this Twig extension. | |
Micon:: |
public static | function | Render the icon. |