I ran into an issue today while testing migrate. Field type taxonomy_term_reference does not have it's default field settings merged into the field or the field instance. Mainly, the parent key. I would imagine this could be an issue for all field types.

The issue can be seen by commenting out the parent key in TermFieldMultipleVocabularyTest when creating the fields.

Comments

chx’s picture

Issue tags: +Entity Field API
chx’s picture

So the default settings is

array(
  'options_list_callback' => NULL,
  'allowed_values' => array(
    array(
      'vocabulary' => '',
      'parent' => '0',
    ),
  ),
);

And a given setting looks like this

array(
  'allowed_values' => array(
      array(
        'vocabulary' => 'vocabulary1',
      ),
      array(
        'vocabulary' => 'vocabulary2,
     ),
  ),
)

And somehow $settings['allowed_values'][0]['parent'] and $settings['allowed_values'][1]['parent'] both needs to be set to $default_values['allowed_values'][0]['parent']. I can't possibly see how we could do that in a generic fashion.

chx’s picture

I believe the solution is to split up https://drupal.org/node/2124403 into separate pages and add this warning to create:

"Beware that settings defaults from the field type annotation are only added for top level keys. For example, in TermFieldMultipleVocabularyTest::setUp if 'parent' => 0 were removed, it would not get merged in because the top level 'allowed_values' key would still exist."

yched’s picture

settings defaults from the field type annotation are only added for top level keys

Yup.

chx’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.