Links
- Drupal APIs
- Theme API and render elements
- Render Arrays
- EntityQuery with fields
- RESTful Web Services API overview
- Utiliser un fork de module avec Composer
- Early rendering
- Dependency Injection for a Form
Corriger l’update status
delete from key_value where collection = 'update_fetch_task';
Mode de développement
../vendor/bin/drupal site:mode dev
Useful drush commands while developing your hook_update_N
Checking the current schema version of a module
drush php-eval "echo drupal_get_installed_schema_version('my_module');"
Manually setting the current schema version of a module
drush php-eval "echo drupal_set_installed_schema_version('my_module', '8000');"
Entity update mismatch
La définition des entités et/ou des champs ne correspondent pas. Charger le module PHP Devel
$entity_type_manager = \Drupal::entityTypeManager();
$entity_type_manager->clearCachedDefinitions();
$entity_type_ids = [];
$change_summary = \Drupal::service('entity.definition_update_manager')
->getChangeSummary();
foreach ($change_summary as $entity_type_id => $change_list) {
$entity_type = $entity_type_manager->getDefinition($entity_type_id);
\Drupal::entityDefinitionUpdateManager()->installEntityType($entity_type);
$entity_type_ids[] = $entity_type_id;
}
Clear cache
$variables['#cache']['max-age'] = 0;
\Drupal::service('page_cache_kill_switch')->trigger();
cache_clear_all() // For Drupal-7
drupal_flush_all_caches() // For Drupal-8
\Drupal::service('cache.render')->invalidateAll();
If you want to clear specific cache like render cache then you can run the following code:
\Drupal::service('cache.render')->invalidateAll();
PHP
If you want to clear specific cache like route cache then you can run the following code:
\Drupal::service("router.builder")->rebuild();