1 field.module | field_config_create(Config $staging_config) |
Implements hook_config_create().
Related topics
File
- core/
modules/ field/ field.module, line 563 - Attach custom data fields to Backdrop entities.
Code
function field_config_create(Config $staging_config) {
$config_name = $staging_config->getName();
if (strpos($config_name, 'field.field.') === 0) {
$field_data_table_exists = FALSE;
$field = $staging_config->get();
$schema = _field_sql_storage_schema($field);
foreach ($schema as $name => $table) {
if (db_table_exists($name)) {
$field_data_table_exists = TRUE;
break;
}
}
if (!$field_data_table_exists) {
if (!field_info_field_types($field['type'])) {
// If there is no available cached information about the field type (for
// example if we enabled a dependency that defines a new type), reset
// the field type cache.
_field_info_collate_types_reset();
}
field_create_field($field);
}
}
}