FieldDefinition::setDisplayOptions() says that $options should include at least a 'weight', or specify 'type' = 'hidden'.
FieldDefinitionInterface::getDisplayOptions(), instead, says that 'hidden' was a valid value, but it is now deprecated in favor of specifying 'region' => 'hidden'.

The first page should be corrected not to conflict what the last page says.

array $options: An array of display options. Refer to \Drupal\Core\Field\FieldDefinitionInterface::getDisplayOptions() for a list of supported keys. The options should include at least a 'weight', or specify 'region' = 'hidden'. The 'default_widget' / 'default_formatter' for the field type will be used if no 'type' is specified.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kiamlaluno created an issue. See original summary.

apaderno’s picture

joachim’s picture

Status: Needs review » Reviewed & tested by the community

Good catch!

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed d7f58c36ff to 9.0.x and 295a6c45de to 8.9.x and ab2cefd0ca to 8.8.x. Thanks!

Yep this looks great - see the CR that changed this https://www.drupal.org/node/2801513

  • alexpott committed d7f58c3 on 9.0.x
    Issue #3105925 by kiamlaluno: The description of the arguments for...

  • alexpott committed 295a6c4 on 8.9.x
    Issue #3105925 by kiamlaluno: The description of the arguments for...

  • alexpott committed ab2cefd on 8.8.x
    Issue #3105925 by kiamlaluno: The description of the arguments for...

Status: Fixed » Closed (fixed)

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