function FieldHooks::configImportStepsAlter

Implements hook_config_import_steps_alter().

File

core/modules/field/src/Hook/FieldHooks.php, line 255

Class

FieldHooks
Hook implementations for field.

Namespace

Drupal\field\Hook

Code

public function configImportStepsAlter(&$sync_steps, ConfigImporter $config_importer) : void {
    $field_storages = ConfigImporterFieldPurger::getFieldStoragesToPurge($config_importer->getStorageComparer()
        ->getSourceStorage()
        ->read('core.extension'), $config_importer->getStorageComparer()
        ->getChangelist('delete'));
    if ($field_storages) {
        // Add a step to the beginning of the configuration synchronization process
        // to purge field data where the module that provides the field is being
        // uninstalled.
        array_unshift($sync_steps, [
            '\\Drupal\\field\\ConfigImporterFieldPurger',
            'process',
        ]);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.