function EntityDisplayFormBase::buildExtraFieldRow
Same name in other branches
- 8.9.x core/modules/field_ui/src/Form/EntityDisplayFormBase.php \Drupal\field_ui\Form\EntityDisplayFormBase::buildExtraFieldRow()
- 10 core/modules/field_ui/src/Form/EntityDisplayFormBase.php \Drupal\field_ui\Form\EntityDisplayFormBase::buildExtraFieldRow()
- 11.x core/modules/field_ui/src/Form/EntityDisplayFormBase.php \Drupal\field_ui\Form\EntityDisplayFormBase::buildExtraFieldRow()
Builds the table row structure for a single extra field.
Parameters
string $field_id: The field ID.
array $extra_field: The pseudo-field element.
Return value
array A table row array.
2 calls to EntityDisplayFormBase::buildExtraFieldRow()
- EntityDisplayFormBase::form in core/
modules/ field_ui/ src/ Form/ EntityDisplayFormBase.php - Gets the actual form array to be built.
- EntityViewDisplayEditForm::buildExtraFieldRow in core/
modules/ field_ui/ src/ Form/ EntityViewDisplayEditForm.php - Builds the table row structure for a single extra field.
1 method overrides EntityDisplayFormBase::buildExtraFieldRow()
- EntityViewDisplayEditForm::buildExtraFieldRow in core/
modules/ field_ui/ src/ Form/ EntityViewDisplayEditForm.php - Builds the table row structure for a single extra field.
File
-
core/
modules/ field_ui/ src/ Form/ EntityDisplayFormBase.php, line 479
Class
- EntityDisplayFormBase
- Base class for EntityDisplay edit forms.
Namespace
Drupal\field_ui\FormCode
protected function buildExtraFieldRow($field_id, $extra_field) {
$display_options = $this->entity
->getComponent($field_id);
$regions = array_keys($this->getRegions());
$extra_field_row = [
'#attributes' => [
'class' => [
'draggable',
'tabledrag-leaf',
],
],
'#row_type' => 'extra_field',
'#region_callback' => [
$this,
'getRowRegion',
],
'#js_settings' => [
'rowHandler' => 'field',
],
'human_name' => [
'#markup' => $extra_field['label'],
],
'weight' => [
'#type' => 'textfield',
'#title' => $this->t('Weight for @title', [
'@title' => $extra_field['label'],
]),
'#title_display' => 'invisible',
'#default_value' => $display_options ? $display_options['weight'] : 0,
'#size' => 3,
'#attributes' => [
'class' => [
'field-weight',
],
],
],
'parent_wrapper' => [
'parent' => [
'#type' => 'select',
'#title' => $this->t('Parents for @title', [
'@title' => $extra_field['label'],
]),
'#title_display' => 'invisible',
'#options' => array_combine($regions, $regions),
'#empty_value' => '',
'#attributes' => [
'class' => [
'js-field-parent',
'field-parent',
],
],
'#parents' => [
'fields',
$field_id,
'parent',
],
],
'hidden_name' => [
'#type' => 'hidden',
'#default_value' => $field_id,
'#attributes' => [
'class' => [
'field-name',
],
],
],
],
'region' => [
'#type' => 'select',
'#title' => $this->t('Region for @title', [
'@title' => $extra_field['label'],
]),
'#title_display' => 'invisible',
'#options' => $this->getRegionOptions(),
'#default_value' => $display_options ? $display_options['region'] : 'hidden',
'#attributes' => [
'class' => [
'field-region',
],
],
],
'plugin' => [
'type' => [
'#type' => 'hidden',
'#value' => $display_options ? 'visible' : 'hidden',
'#parents' => [
'fields',
$field_id,
'type',
],
'#attributes' => [
'class' => [
'field-plugin-type',
],
],
],
],
'settings_summary' => [],
'settings_edit' => [],
];
return $extra_field_row;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.