public function Marquee::getInfo in Examples for Developers 8
Same name and namespace in other branches
- 3.x modules/render_example/src/Element/Marquee.php \Drupal\render_example\Element\Marquee::getInfo()
Returns the element properties for this element.
Return value
array An array of element properties. See \Drupal\Core\Render\ElementInfoManagerInterface::getInfo() for documentation of the standard properties of all elements, and the return value format.
Overrides ElementInterface::getInfo
File
- 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',
],
];
}