function Marquee::getInfo
Same name in other branches
- 3.x modules/render_example/src/Element/Marquee.php \Drupal\render_example\Element\Marquee::getInfo()
Overrides ElementInterface::getInfo
File
-
modules/
render_example/ src/ Element/ Marquee.php, line 42
Class
- Marquee
- Provides a marquee render element.
Namespace
Drupal\render_example\ElementCode
public function getInfo() {
// Returns an array of default properties that will be merged with any
// properties defined in a render array when using this element type.
// You can use any standard render array property here, and you can also
// custom properties that are specific to your new element type.
return [
// See render_example_theme() where this new theme hook is declared.
'#theme' => 'render_example_marquee',
// Define a default #pre_render method. We will use this to handle
// additional processing for the custom attributes we add below.
'#pre_render' => [
[
self::class,
'preRenderMarquee',
],
],
// This is a custom property for our element type. We set it to blank by
// default. The expectation is that a user will add the content that they
// would like to see inside the marquee tag. This custom property is
// accounted for in the associated template file.
'#content' => '',
'#attributes' => [
'direction' => 'left',
'loop' => -1,
'scrollamount' => 'random',
],
];
}