0

I want to add the titles of another existing type of nodes to a select list field from another content type.

I tried to do it altering the form but it gives me an error because the values added are not in the select list permitted values.

I also tried creating a config file for the field named. field.storage.node.field_name where field_name is the select field name, but it doesn't do anything.

type: list_string
settings:
  allowed_values: {  }
  allowed_values_function: 'module_allowed_values_function'

The function is created in the .module and returns an array with one value just to test, but the field doesn't appear to be modified.

2
  • 1
    Did you actually import the config file after changing it? e.g. drush cim on command-line. What's the name & content of your .module file ?
    – Hudri
    Nov 10 at 13:20
  • 1
    If you are trying list "the titles of another existing type of nodes," you are probably better off using an entity reference View rather than a flat list. Alternatively, you would need to list every possible value in your config as allowed.
    – beltouche
    Nov 10 at 13:29

Your Answer

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