Drupal 8

Create a content type programatically Drupal 8

​Basic creation of a content type in Drupal 8. Content type is created in code in a custom module called dribbit_create_content_type.


As seen on the left, an install directory located in the config directory is needed to store the content types yaml file. Human readable data is used to preconfigure the content types settings.

Create a block programatically in Drupal 8


Basic creation of a block in Drupal 8. As seen in the image on the left, a predefined library structure is needed to create a block plugin.

The annotations plugin is used to handle the block id, subject and admin label from within the comment block. The annotation class is found at core/lib/Drupal/Component/Annotation/Plugin.php.

Reinstall Drupal 8

Reinstalling a Drupal 8 site can't be bruteforced as in Drupal 7 where dropping all tables in the database is enough to reinstall a site.

One of the reasons why just dropping tables in the database isn't enough is that the config directory (e.g. sites/default/files/config_somehashkey) needs to be deleted.

What is Drupal

Drupal is one of the most popular CMS (content management system) around. One of the reasons is that with Drupal, editors and site administrators don't need a technical background to manage and insert content to a site. Possibilities for sites are endless.

Subscribe to RSS - Drupal 8