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

26/09/2019, by mikhail
Plugins

In this tutorial, we will look at how to output blocks programmatically through a custom module in Drupal 8.

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

Let's start by adding a file containing a PHP class, this is how blocks are created in Drupal through a custom module. The process of creating the file is the same as the class for the page, as we did here:

Plugins
25/09/2019, by mikhail
Route

We can use the parameters in the URL for routes. They work just like contextual filters in Views. We can for example pass in the URL the ID of various entities, text strings or sequential ID separated by comma or pluses. In this lesson, we will pass the ID of the node and display the title and body of this node in the content.

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

Let's add route to our drupalbook.routing.yml module file:

Route
25/09/2019, by mikhail
documentation

As you learn the Drupal API, you will often need to refer to the main documentation at https://api.drupal.org. This is the automatically generated Drupal documentation. It contains all the information about each function, class, method, where they are defined, where a brief description is used. Also on this site there is API help, I advise you to familiarize yourself with each of the sections:

documentation
24/09/2019, by mikhail
Drupal module

Let's start creating our module with a little ordering. Let's continue to separate custom and contributed modules. In Drupal modules are in the / modules folder. Now we do not need to put them deep into /sites/all/modules, although readme says that this should work, use the /modules folder after all. Inside the /modules folder, we will create two custom and contrib folders. The contrib folder will store additional modules from drupal.org, and our custom modules will be stored in the custom folder.

English subtitles:

Drupal module
23/09/2019, by mikhail
Server

In this article, we will not write code, but prepare to write code. To do this, we will install Drush. Drush is a console utility that allows you to perform many routine operations with Drupal: update modules, upload / download configuration, backup and much more.

If you use Open Server as a web server for development, then this instruction will suit you:

1. Install the server itself. You can download it from the author's website open-server.ru. Installation and documentation there.

Server
23/09/2019, by mikhail
Drupal Module Development

Everything we disassembled before, everything was like the previous versions of Drupal. But with the development, everything is different. Although visually Drupal looks the same as Drupal 7, inside Drupal consists of Symfony components, its components, as well as many libraries. Therefore, you have to deal with the new plugin system, deal with OOP in PHP.

To begin with, we will start with the pretty familiar things Drupal hooks, then we will figure out how Drupal works with pages (route), add a new page, consider how Drupal processes requests.

Drupal Module Development