1

When I create a field field.field.node.custom.body.yml in my custom module with the following code:

langcode: en
status: true
dependencies:
  config:
    - field.storage.node.body
    - node.type.customblog
  module:
    - text
id: node.customblog.body
field_name: body
entity_type: node
bundle: customblog
label: Body
description: ''
required: false
translatable: true
default_value: {  }
default_value_callback: ''
settings:
  display_summary: true
field_type: text_with_summary

The Body field is created and added to the appropriate CT when installed, but is set as disabled in the manage display. This seems to be default behavior. I would like the field to be enabled as the module is installed through the use of .yml files, is this possible?

1

There is a single config entity per entity_type, bundle and view/form mode. If you fully control that, then you can provide those config entities, if you just add a single field to something existing, you need to use the API to add your fields configuration to it.

See core.entity_form_display.node.article.default.yml in standard.profile and various others for examples.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.