logo

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

Articles

02/10/2019, by mikhail
fields in Drupal

In previous articles we have seen how the Link field type works: Storage, Widget, Formatter. In this article we will make our own bone field type for outputting video from youtube on a page with two different formats and settings.

This article focuses on the Fields API, and if you need to add the Yotube video field to your site, it is better to use the ready-made module:

https://www.drupal.org/project/video_embed_field

fields in Drupal
02/10/2019, by mikhail
Drupal Fields API

In this article we will consider Field Formatters, that allow us to edit the display of fields and display them on the page. 

In past articles, we created field type Link, in this article we will look at how these fields are displayed on the page and which class is responsible for it. Each field that you add through Drupal can be displayed on the page and edit its settings on the page Manage display. 

Drupal Fields API
01/10/2019, by mikhail
Drupal Fields API

In this tutorial we will look at how the Field Widget of the Link module works. This is a review article, so if you want to start writing your File Widget, please skip to the following articles.

In the last lesson we added Link fields for nodes and blocks. Now let's look at what the form for the Link field is formed by.

We have already met with autoloading of PHP classes in Drupal, and there is also a WidgetBase field widget class for fields:

core/lib/Drupal/Core/Field/WidgetBase.php

Drupal Fields API
01/10/2019, by mikhail
Config

Very often access to 3rd party services must be different on dev and live instans. In order to do this with the help of configurations, you need to use the Configuration Split module:

https://www.drupal.org/project/config_split

After you enable the Config Split module, you will be able to specify the folders for the instances. Let's go to the Configuration Split settings page of the Configuration module:

/admin/config/development/configuration/config-split

Config
30/09/2019, by mikhail
Drupal configs

Configuration in Drupal is the basis for all settings of content types, fields, configuration forms and variables. With the help of configuration we can transfer changes from one site to another, develop different features at the same time and without interfering with each other.

Configurations can be uploaded to YML files and added to the Git repository, so you can commit your changes in site settings and transfer the changes to Dev or Live. The idea of configuration in Drupal is similar to how the Features module works:

Drupal configs
30/09/2019, by mikhail
Miltistep popup form in Drupal

In this article we will continue to understand Form API in Drupal 8 and make a multistep form. We have already created the usual configuration form for the module, the multistep form is created in a similar way using $form_state to store data between the form steps.

Examples of code can be found at github:

https://github.com/levmyshkin/drupalbook8

For a multistep form you need to add a form class:

/modules/custom/drupalbook/src/Form/MultiStepForm.php

Miltistep popup form in Drupal
27/09/2019, by mikhail
hook_form_alter

In one of the previous lessons we have learned what hooks are, in this lesson we will work with hook_form_alter() hooks in practice and add functionality to the existing form.

Examples of code can be found at github:
https://github.com/levmyshkin/drupalbook8

In this lesson we will start to look at hooks in practice, later on we will return to hooks and look at a couple of other examples. For now, let's start with hook_form_alter().

hook_form_alter
27/09/2019, by mikhail
Working with forms in Drupal 8

In this tutorial, we will deal with the Drupal Form API and create a settings form for the module. We have already created modules for displaying the page and block, let's now create a configuration form in which we will store data for connecting to a conditional service. Let's say that we need to store the API Key and the API Client ID on the site, for example, for the Google Maps API.

Code examples can be viewed on github:
https://github.com/levmyshkin/drupalbook8

Working with forms in Drupal 8