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

Drupal 8

By editor , 16 December, 2015

Event on Entity / Node / User ... delete

Tags

  • Drupal 8
  • Code
  • Node
  • User

For this, You must use hook_entity_delete.

Example :
function mymodule_entity_delete(\Drupal\Core\Entity\EntityInterface $entity) {
  $entity_type = $entity->getEntityTypeId();
  $entity_id = $entity->id();

By editor , 14 December, 2015

Get args from URL in Drupal 8

Tags

  • Drupal 8
  • Code

Example: 

By editor , 10 December, 2015

Set the page title programmatically in Drupal 9

Tags

  • Drupal 8
  • Code
  • Drupal 9

Change on a form or controller

Just set ['#title'] element.

Form Example : $form['#title'] = "The title";

By editor , 9 December, 2015

Login programmatically as a user

Tags

  • Drupal 8
  • Code
  • User

Example:
$user = User::load($uid);
user_login_finalize($user);

By editor , 9 December, 2015

Get all user's roles

Tags

  • Drupal 8
  • User
  • Code

Get All roles:
    $roles = \Drupal\user\Entity\Role::loadMultiple();

By editor , 8 December, 2015

Form API Error - illegal selection

Tags

  • Drupal 8
  • Form
  • Code

Most likely, this error is due to dynamicaly changed options list.

If you want to change the values of the options list, You must add:
'#validated' => TRUE

By editor , 8 December, 2015

Database LIKE condition

Tags

  • Drupal 8
  • Database
  • Code

The like condition syntax is:
$query->condition('field_name', "%" . $query->escapeLike("The string") . "%", 'LIKE');

Example:

By editor , 7 December, 2015

Drupal Mysql / Database Data types

Tags

  • Drupal 8
  • Database
  • Drupal 7

Link : https://www.drupal.org/node/159605

By editor , 7 December, 2015

Add JavaScript to a module

Tags

  • Drupal 8
  • Theming
  • JavaScript

Add JavaScript as libraries

Like a CSS, You can add a JS as a librarie

By editor , 6 December, 2015

Create Taxonomy Vocabulary programmatically on Drupal 8

Tags

  • Drupal 8
  • Code
  • Taxonomy

Exaple:

Pagination

  • Previous page
  • 19
  • Next page
Drupal 8

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