Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function viewElements(FieldItemListInterface $items, $langcode) {
- $elements = [];
- foreach ($items as $delta => $item) {
- $elements[$delta] = [
- '#theme' => 'my_field',
- '#type' => 'markup',
- // etc...
- ];
- }
- return $elements;
- }
- function my_field_theme() {
- return array(
- 'location_field' => array(
- 'variables' => array(
- 'x' => NULL,
- 'y' => NULL,
- 'z' => NULL,
- ),
- 'template' => 'my_field',
- ),
- );
- }
- <section class="class">
- <h2>name</h2>
- <div class="cls" data-x="x" data-y="y" data-z="z">content</div>
- </section>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement