function some_config_update_8101(){ if ( !FieldConfig::load('image_byline') ){ $config_path = drupal_get_path('module', 'some_config') . '/config/install/field.field.node.main_image.field_image_byline.yml'; $data = Yaml::parse($config_path); Drupal::configFactory()->getEditable('field.field.node.main_image.field_image_byline')->setData($data)->save(TRUE); $message .= "FieldConfig installed for module some_config.n"; } else { $message .= "It didn't work!n"; } if( !FieldConfigStorage::load('image_byline') ){ $config_path = drupal_get_path('module', 'some_config') . '/config/install/field.storage.node.field_image_byline.yml'; $data = Yaml::parse($config_path); Drupal::configFactory()->getEditable('field.storage.node.field_image_byline')->setData($data)->save(TRUE); $message .= "FieldConfigStorage installed for module some_config.n"; } else{ $message .= "That didn't work either!n"; }
Above is the code I am attempting to use to update a content type with a new field on my site. When I run the dbup command I get “PHP Fatal error: Using $this when not in object context in EntityStoageBase.php.
How is my code affecting the context of EntityStorageBase, if I have not changed code in that file?
Sponsored by SupremePR