Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Drupal 8 Module Development

You're reading from   Drupal 8 Module Development Build modules and themes using the latest version of Drupal 8

Arrow left icon
Product type Paperback
Published in Mar 2019
Publisher Packt
ISBN-13 9781789612363
Length 580 pages
Edition 2nd Edition
Languages
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Daniel Sipos Daniel Sipos
Author Profile Icon Daniel Sipos
Daniel Sipos
Arrow right icon
View More author details
Toc

Table of Contents (20) Chapters Close

Preface 1. Developing for Drupal 8 FREE CHAPTER 2. Creating Your First Module 3. Logging and Mailing 4. Theming 5. Menus and Menu Links 6. Data Modeling and Storage 7. Your Own Custom Entity and Plugin Types 8. The Database API 9. Custom Fields 10. Access Control 11. Caching 12. JavaScript and the Ajax API 13. Internationalization and Languages 14. Batches, Queues, and Cron 15. Views 16. Working with Files and Images 17. Automated Testing 18. Drupal 8 Security 19. Other Books You May Enjoy

Blocks

Blocks in Drupal 8 are plugins. However, the blocks you create in the UI are content entities and the placement of both in the block layout are configuration entities. So, the block system is a good example of how entities and plugins work hand in hand in Drupal 8. We will talk in more detail about plugin types and entities later in the book.

The block system in Drupal 8 is a great shift from its predecessor. Before, you had to implement two obligatory hooks plus two optional hooks if you wanted the block to have a configuration, and the latter was always saved somewhere that had nothing to do with the block itself. In Drupal 8, we work with a simple plugin class that can be made container-aware (that is, we can inject dependencies into it) and we can store configuration in a logical fashion.

So, how do we create a custom block plugin? All we need is one class, placed in...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime