Extra Block Types (EBT) - New Layout Builder experience❗

Extra Block Types (EBT) - styled, customizable block types: Slideshows, Tabs, Cards, Accordions and many others. Built-in settings for background, DOM Box, javascript plugins. Experience the future of layout building today.

Demo EBT modules Download EBT modules

❗Extra Paragraph Types (EPT) - New Paragraphs experience

Extra Paragraph Types (EPT) - analogical paragraph based set of modules.

Demo EPT modules Download EPT modules

Scroll
26/04/2020, by maria

In Drupal 8, all field types, widgets, and formatters are plugins.

They are automatically discovered if placed in the expected directory structure and use the correct annotation.

The directory structure for a module that implements all three looks like this:

foo_bar_fields

  • foo_bar_fields.info.yml
  • src/
    • Plugin/
      • Field/
        • FieldType/
          • FooItem.php
        • FieldFormatter/
          • FooBarFormatter.php
        • FieldWidget/
          • FooBarWidget.php

In this tutorial, we will create a custom field type, field formatter, and field widget that generates a random string and displays it.

The module will be named random and will follow this structure:

random

  • random.info.yml
  • src/
    • Plugin/
      • Field/
        • FieldType/
          • RandomItem.php
        • FieldFormatter/
          • RandomDefaultFormatter.php
        • FieldWidget/
          • RandomDefaultWidget.php

Drupal’s online documentation is © 2000-2020 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License.