Block access

Another major area where you will deal with access is when trying to control access to a custom block. If you remember in Chapter 2, Creating Your First Module, we created the HelloWorldSalutationBlock plugin so that our salutation can also be rendered using a block. Now, that block can be placed in a region and even configured to show up only on certain pages, for certain user roles, or even on node pages restricted by bundle. This is all done in the UI:

However, this is oftentimes not enough, and you will want to have a block placed in a region and control yourself under what circumstances it should show up--enter block access. ...

Get Drupal 8 Module Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.