Custom Plugin Type In Drupal 8

Udit Rawat
6 min readFeb 11, 2020
Custom Plugin Type In Drupal 8

We often use some prebuild structure as a starting point of our project/module and most of the Framework/CMS are now providing their CLI tools which automatically generate boilerplate templates by using some commands, Like ionic generate in ionic framework, php artisan create in Laravel and drupal generate in drupal console.

The basic idea behind those commands is to provide an interface, from which a developer can start writing solutions for a specific problem. Drupal plugin has a similar concept, the Base module defines plugin interface and some utility code. and other modules start by implementing that interface. However, we can define plugins in lots of other ways.

  • It’s a new way in Drupal 8 to develop extensible modules.
  • It’s a general reusable solution for a recurring problem.
  • It provides a way to implement alterable functionality in modules.

Drupal documentation defines plugin as below.

The basic idea of plugins is to allow a particular module or subsystem of Drupal to provide functionality in an extensible, object-oriented way. The controlling module or subsystem defines the basic framework (interface) for the functionality, and other modules can create plugins (implementing the interface) with particular behaviors. The controlling module instantiates…

--

--

Udit Rawat

Full Stack Developer, Passionate about innovations in coding and mobile applications. [https://drupaljournal.com/]