Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
Tutorial on Using Drupal 8 Plugin Derivatives Effectively
Jan 20, 2016 @ 18:24:38

The SitePoint PHP blog has a tutorial posted for the Drupal users out there showing you how to use plugin derivatives effectively.

In this article we will explore the long answer to that and learn what derivates are and how we can use them. For the latter, we will build an example inside the demo module that can be found in this git repository and which should hopefully help us better understand what’s going on. For a slightly more complex example, the Menu system is great as it provides an individual block for each of its menus (similar to Drupal 7 but using plugins).

They're basically creating a system that allows the dynamic creation of Node Blocks for each of the article nodes but it's just an example of how (and not a recommendation on what you should do). They start in by talking about plugin derivatives - what they are and how they fit into the overall Drupal 8 code structure. The tutorial then shows the creation of the derivative class and explain each part of the code that makes it up. Following this is the other half of the functionality, is the block plugin class that will generate the instances of itself as requested.

tagged: drupal8 plugin derivatives example tutorial node block article

Link: http://www.sitepoint.com/tutorial-on-using-drupal-8-plugin-derivatives-effectively/


Trending Topics: