Thanks to Adam Bramley for reminding me of this feature. The advantage of this approach is you don't need to keep an extra module around (Base Field Override UI) just for one-off changes. for the User entity, use user for both the entity type ID and bundle. If the entity-type you need to override doesn't support bundles, just use the entity type ID in place of the bundle, e.g. You can now edit this file and make the changes you need, and then re-import it using drush config:import -y. Once that is done, you can run drush config:export -y to export your configuration and you should see a new core.base_field_override.block_ in your config export folder. to export the YML of the 'info' (label) field on the block content entity from 'Block description' for a block-type called 'gallery' you would runĭrush php-eval "\Drupal::service('entity_field.manager')->getBaseFieldDefinitions('block_content')->getConfig('gallery')->save() " I wish entityreference can reference exportables properly, via machine name. Each contact type revert introducing a new local ID which means field values are no longer valid. Just substitute the entity type ID, field name and bundle.Į.g. The issue arise when you referencing contact type in entity reference fields. But first you need a mechanism to generate the YML.Īt present, the simplest way to do that is using Drush to evaluate the following.ĭrush php-eval "\Drupal::service('entity_field.manager')->getBaseFieldDefinitions()->save() " For those cases, you need to revert to editing YML. This lets you change the title and description via a UI.īut there are more properties a field override can contain, such as default values, required state and even field settings. Well, you've got two options - one is to use the Base Field Override UI module. So how do you go about using this feature. These config entities can be used to modify base fields on a per-bundle basis.ĭrupal core uses them to change the label of the Title field for a given node-type or the default state of the 'Promoted to front page' field.īut the same mechanism can be used for any entity-type. If you've ever changed the label of the Title field for a node-type and then exported your configuration, you've probably seen a core.base_field_override file pop up in the exported files. This subsequently caused Drupal 8 installation problems on various shared hosts (20, 21, 22, others). ![]() ![]() You may not be aware, but Drupal core has a mechanism for changing base field definitions without code, but other than for nodes, there's no real UI to make use of this API.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |