[Drupal] Change CKEditor behaviour for line breaks (br or p)

Here is a little code snippet to be added in a .module file.

Additional Information Instructions made on Drupal 8.5.x. Will break text align buttons in the CKEditor toolbar: Issue on Drupal.org The default behaviour of CKEditor is the following: Enter: inserts a paragraph directly in the WYSIWYG, Shift + Enter: inserts a line […]

[Drupal] Make the Search API Page search block appear in Bootstrap markup

When using Search API Page, I needed to theme the search form in the bootstrap structure. The cleanest answer I have found is to add some variables to trigger the bootstrap overrides on the search form.

Additional Information Instructions made on Drupal 8.3.x (probably, haha).

[Drupal] Use admin_block and admin_block_content templates

This article is about the default admin_page, admin_block and admin_block_content templates which serves as the base of the content display on some system configuration pages such as the one on this image: The code

Explanation If you use admin_page, you will be able to define the column in which the blocks dwell: left or […]

[Drupal] Base hook schema example to put in .install

Introduction Delighted hook_schema is one of those methods where you are happy to have a usable documentation on the api website. It is pretty much self-explanatory and you don’t have to look for hours on third parties websites to get some usable information. 🙂 hook_schema on api.drupal.org and don’t forget to select your Drupal version! […]

[Drupal] Table render array example structure

Result The code

Additional Information Tested to work on Drupal 8.2.x. For some reason, no_striping doesn’t work as expected in 8.2.x (it is ignored). The script which handles the render array conversion to twig ready variables is located here: core\includes\theme.inc. The twig template which renders the table on the default theme is here: core\themes\classy\templates\dataset\table.html.twig.

[Drupal] Create an event subscriber

Instructions I will be creating a dedicated module using Drupal Console for this event subscriber. But feel free to use your own if you already have one! (don’t forget to backup) Access the drupal root folder in command line. Generate a new module:

Generate the event subscriber. We will subscribe to the kernel.request event: […]