Following up from my post last week, I wanted to add some additional material regarding React on Drupal...I hope you'll find it useful...

Bonus - Extend the components to Drupal regions

The react image gallery module provides a very easy way to display an image gallery on any piece of content, however what happen if we want to include it outside of the contents (e.g. Block regions), or in a Modal?

That can be easily handled using a custom block type (remember that blocks now are entities, so we can do exactly what we do with content types). We only need to create a block with an entity reference field (paragraphs) and insert a new instance in the block region we want and it will work automatically.

 

 

 

If we want to load the block in a modal, we can make use of Block Styles module (https://www.drupal.org/project/block_styles) in combination with the bootstrap module, as they permit to define actions (collapse, modal, etc..) on the block, for a modal  we just need to configure the proper style in the block configuration:

and when it is rendered on the page we have:

So I'm making use of Drupal features without depending on extra code and still being able to produce something useful.

 

Read Next
Appnovation

Top Digital Branding Trends and Challenges in a Mature Digital Age

17 May, 2018|7 min