I create by YAML files a Field Custom, using the next documentation:


In this tutorial attach the field to Custom Type "car_brand" created by code, in my case I need attach the custom field to the Custom Type "page", he come default in drupal.

How I can attach the field to "page" content type?

Thanks a lot.

1 Answer 1


You just have to create or change the file attaching the field to instead be attached to the page content type:

First we'll have to rename it: field.field.node.page.field_brand_information.yml

Secondly, we should be fine just changing all the references from car_brand to the page bundle instead:

# field.field.node.page.field_brand_information.yml
langcode: en
status: true
    - field.storage.node.field_brand_information
    - node.type.page
    - text
id: node.page.field_brand_information
field_name: field_brand_information
entity_type: node
bundle: page
label: 'Brand Information'
description: 'More specific information about the car brand'
required: false
translatable: false
default_value: {  }
default_value_callback: ''
  display_summary: false
field_type: text_with_summary

Generally this approach is quite tedious and I agree as also pointed out in the article that you rather do it through the UI and then export the files appropriately.

  • In the tutorial they create two files core.entity_form_display.node.page.default, core.entity_view_display.node.page.default. When I install the module show me both files "already exist in active configuration".
    – Daniel FS
    Jan 5, 2017 at 21:43
  • Yes. The content type Page already exists and therefor its display configuration for the form display and entity_view does so as well. It looks like Drupal does not handle these overrides for you. Here are some relevant links: drupal.stackexchange.com/questions/186421/… drupal.stackexchange.com/questions/187476/…
    – johndevman
    Jan 5, 2017 at 21:52

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.