Skip to main content
Drupal 8

Main navigation

  • Home
    • Question And Answer
    • NEWS
    • Projects
  • Tutorials - Drupal
    • Android
    • Other
User account menu
  • Log in

Breadcrumb

  1. Home

Hook

By editor , 1 November, 2018

Alter Views title programmatically on Drupal 8

Tags

  • Drupal 8
  • Code
  • Views
  • Hook

function MYMODULE_views_pre_render(ViewExecutable $view) {
 if ($view->id() == 'ABC') {
  $view->setTitle('MY CUSTOM TITLE');
 }
}

By editor , 19 January, 2018

Event dispatcher. Create event, Dispatch and Subscribe.

Tags

  • Drupal 8
  • Code
  • Module
  • Services
  • Hook

Drupal's event system allow to create triggers when an event has been happened like create a custom hook on drupal 7.

By editor , 19 January, 2018

Event Subscriber to replace hook_boot and hook_init

Tags

  • Drupal 8
  • Code
  • Services
  • Hook

Use Event Subscriber service.

The EventSubscriber allow to execute an action on boot as hook_boot or hook_init of drupal 7.

Example.

By editor , 28 July, 2017

Change a metatag dynamicly

Tags

  • Drupal 8
  • Code
  • SEO
  • Hook

Add meta tag from controller

Example: Add <meta http-equiv="refresh" content="30">
$data = [
  '#tag' => 'meta',
  '#attributes' => [

By editor , 8 July, 2016

Create a simple module to use Drupal 8 Hook System

Tags

  • Drupal 8
  • Code
  • Module
  • Hook

Drupal 8 Hook System

Hooks allow modules to alter the drupal core behavior or another module. Hooks are discovered and called at specific times to alter or add to the base behavior or data (invoking the hook). Each hook has a name start with hook_ (Ex; hook_menu()).

By editor , 15 April, 2016

Views with custom Tables - hook_views_data

Tags

  • Drupal 8
  • Code
  • Views
  • Hook

 

Officiel Documentation :

 https://api.drupal.org/api/drupal/core!modules!views!views.api.php/function/hook_views_data/8

 

Use multiple database conncetion with views_data() 

For that you must add 'database'

Hook

Links

  • Drupal.org
  • Drupal core release cycle
  • Drupal events with ease
  • Unit test with Drupal using PHPUnit (Drupal 10)
  • Tokens for file upload url
  • Tips for Docker
  • CKEditor inline image files usage for custom forms.
  • Install Docker on Linux Mint
  • Install PHP 8.1
  • Drupal Security Best Practices
  • Order and sort items with tabledrag
  • Add a custom service YAML container
  • Apply a patch with composer