By swentel on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.3.x
Introduced in version:
8.3.0
Issue links:
Description:
Components (fields, extra fields) now store the region in which they are displayed. Field UI now has a Region column which allows you to change the region of a component. This replaces the previous - Hidden - option in the Format column.
There's a BC layer in place when calling EntityDisplayBase::setComponent() or BaseFieldDefinition::setDisplayOptions(), so developers do not have to change their code, which means that underneath code examples will work in both cases.
Before:
// The field region will automatically assigned to the default region.
$entity_display->setComponent('type' => 'default_formatter', 'label' => 'hidden')
// The field will be hidden.
BaseFieldDefinition::create('field')->setDisplayOptions('form', ['type' => 'hidden']);
After:
$entity_display->setComponent('type' => 'default_formatter', 'label' => 'hidden', 'region' => 'content')
BaseFieldDefinition::create('field')->setDisplayOptions('form', ['region' => 'hidden']);
However, a BC layer does not exist for the UI, so Simpletests that post to the Manage Form or Manage Display pages will fail unless updated:
To show a field:
Before:
$edit = array(
'fields[langcode][type]' => 'language',
);
$this->drupalPostForm('admin/structure/types/manage/article/display', $edit, t('Save'));
After:
$edit = array(
'fields[langcode][type]' => 'language',
'fields[langcode][region]' => 'content',
);
$this->drupalPostForm('admin/structure/types/manage/article/display', $edit, t('Save'));
To hide a field:
Before:
$edit = array(
'fields[langcode][type]' => 'hidden',
);
$this->drupalPostForm('admin/structure/types/manage/' . $this->type . '/display/rss', $edit, t('Save'));
After:
$edit = array(
'fields[langcode][region]' => 'hidden',
);
$this->drupalPostForm('admin/structure/types/manage/' . $this->type . '/display/rss', $edit, t('Save'));
Impacts:
Site builders, administrators, editors
Module developers