In Drupal, entities are a representation of data that have a specific structure. There are specific entity types, which have different bundles and fields attached to those bundles. Bundles are implementations of entities that can have fields attached to themselves....
Category: Drupal
Drupal 8 study note 7 : Plug and Play with Plugins-2 Creating a custom plugin type
The plugin system provides means to create specialized objects in Drupal that do not require the robust features of the entity system. In this recipe, we will create a new plugin type called Unit that will work with units of...
Drupal 8 study note 6 : Plug and Play with Plugins-1 Creating blocks using plugins
Creating blocks using plugins Create the src/Plugin/Block directory in your module. This will translate the \Drupal\mymodule\Plugin\Block namespace and allow a block plugin discovery. Create a Copyright.php file in the newly created folder so that we can define the Copyright class...
Drupal 8 study note 5 : Creating a custom theme based on Classy
In the root directory of your Drupal site, create a folder called mytheme in the themes folder. Inside the mytheme folder, create a mytheme.info.yml le so that Drupal can discover the theme. We will then edit this le First, we...
Drupal 8 study note 2: Defining permissions
Permissions are stored in a mymodule.permissions.yml le. Add a mymodule. permissions.yml to the base directory of your module. First, we need to de ne the internal string used to identify this permission, such as view mymodule pages: view mymodule pages:...
Drupal 8 study note 1 Altering existing routes
Altering existing routes Create src/Routing/RouteSubscriber.php in your module. It will hold the route subscriber class: <?php namespace Drupal\mymodule\Routing; use Drupal\Core\Routing\RouteSubscriberBase; use Symfony\Component\Routing\RouteCollection; class RouteSubscriber extends RouteSubscriberBase { /** * {@inheritdoc} */ public function alterRoutes(RouteCollection $collection) { // Change path of...