Дополнительные типы блоков (EBT) — новый опыт конструктора страниц❗

Дополнительные типы блоков (EBT) — стилизованные, настраиваемые типы блоков: слайдшоу, вкладки, карточки, аккордеоны и многие другие. Встроенные настройки для фона, DOM Box, плагины Javascript.

Демо EBT модули Скачать EBT модули

❗Дополнительные типы параграфов (EPT) — новый опыт работы с параграфами

Дополнительные типы параграфов (EPT) — набор модулей, основанный на аналогичных параграфах.

Демо EPT модули Скачать EPT модули

Scroll
26/04/2020, by maria

Menu

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.