I want to create a field with hook_update in my module. I have the following code that creates the configuration for a field_link field:
$module_path = drupal_get_path('module', 'my_module');
$configs['field.field.paragraph.image.field_link'] = $module_path . '/config/install/field.field.paragraph.image.field_link.yml';
$configs['field.storage.paragraph.field_link'] = $module_path . '/config/install/field.storage.paragraph.field_link.yml';
foreach ($configs as $name => $config_path) {
$data = Yaml::parse($config_path);
$config = \Drupal::configFactory()->getEditable($name);
$config->setData($data)->save(TRUE);
}
As far as configuration it seems to be working correctly. When I try to create a node it all displays as it should. But if you save, you get an error that the table doesn't exist. Perhaps I have to use the ConfigInstaller class. Anyone know how to have the table get created?