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) {
      field_create_field($field);
    }
  }
}