1 field.module | field_config_delete_validate(Config $active_config, $all_changes) |
Implements hook_config_delete_validate().
Related topics
File
- core/
modules/ field/ field.module, line 544 - Attach custom data fields to Backdrop entities.
Code
function field_config_delete_validate(Config $active_config, $all_changes) {
$config_name = $active_config->getName();
// @todo: We could support field deletion through config updates, but the
// additional processing time or required cron runs to clear the data could
// cause long imports or user confusion. For now fields have to be manually
// deleted when they contain data, rather than deleted through config.
if (strpos($config_name, 'field.field.') === 0) {
$field_name = $active_config->get('field_name');
$field = $active_config->get();
if (field_has_data($field)) {
throw new ConfigValidateException(t('The field "@field" cannot be deleted through a configuration import. Delete the field manually first, then retry the import.', array('@field' => $field_name)));
}
}
}