Snippets

Metadrop Drupal 8 - Programmatically clear field definition cache.

Created by David López
1
2
3
4
5
6
7
<?php

// Current node field configurations.
$field_manager = \Drupal::getContainer()->get('entity_field.manager');
// Because the manager was already loaded before the above config was forced,
// it will return the old configuration that was cached.
$field_manager->clearCachedFieldDefinitions();

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.