[Drupal] Perfect views block configuration for multilingual node support

Objectives We want to add on a node page layout a block which uses a field from the currently rendered content (node). We want this block to be translated the same as the currently rendered entity. As a anonymous user, we want it to respect the published settings of the currently rendered entity. As an …

[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 public function controllerCallbackExample() { return [ ‘#type’ => ‘table’, ‘#caption’ => ‘This is a caption. Use a translated string here.’, ‘#header’ => [ ‘Header 1’, ‘Header 2’, ‘Header 3’, ‘Header 4’ ], ‘#rows’ => [ [ ‘Row 1 Cell 1’, ‘Row 1 Cell 2’, ‘Row 1 Cell 3’, [‘data’ => ‘Row 1 …

[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: dakwamine@debian-drupal:/var/www/html/drupal$ drupal generate:module Enter the new module name: > Test Module Enter …

Mini point sur ma carrière

J’ai quittĂ© volontiers l’industrie du jeu vidĂ©o, ayant perdu toute motivation d’y travailler. L’entreprise dans laquelle j’avais passĂ© plus de quatre ans Ă  essayer de produire des jeux et des applications est sur le point de fermer dĂ©finitivement. Un chapitre de ma vie est en train de se clore, j’imagine. Avais-je dit que j’Ă©tais rentrĂ© …