protected EntityDisplayFormBase::buildExtraFieldRow($field_id, $extra_field)
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.
File
- core/modules/field_ui/src/Form/EntityDisplayFormBase.php, line 441
Class
- EntityDisplayFormBase
- Base class for EntityDisplay edit forms.
Namespace
Drupal\field_ui\Form
Code
protected function buildExtraFieldRow($field_id, $extra_field) {
$display_options = $this->entity->getComponent($field_id);
$regions = array_keys($this->getRegions());
$extra_field_row = array(
'#attributes' => array('class' => array('draggable', 'tabledrag-leaf')),
'#row_type' => 'extra_field',
'#region_callback' => array($this, 'getRowRegion'),
'#js_settings' => array('rowHandler' => 'field'),
'human_name' => array(
'#markup' => $extra_field['label'],
),
'weight' => array(
'#type' => 'textfield',
'#title' => $this->t('Weight for @title', array('@title' => $extra_field['label'])),
'#title_display' => 'invisible',
'#default_value' => $display_options ? $display_options['weight'] : 0,
'#size' => 3,
'#attributes' => array('class' => array('field-weight')),
),
'parent_wrapper' => array(
'parent' => array(
'#type' => 'select',
'#title' => $this->t('Parents for @title', array('@title' => $extra_field['label'])),
'#title_display' => 'invisible',
'#options' => array_combine($regions, $regions),
'#empty_value' => '',
'#attributes' => array('class' => array('js-field-parent', 'field-parent')),
'#parents' => array('fields', $field_id, 'parent'),
),
'hidden_name' => array(
'#type' => 'hidden',
'#default_value' => $field_id,
'#attributes' => array('class' => array('field-name')),
),
),
'plugin' => array(
'type' => array(
'#type' => 'select',
'#title' => $this->t('Visibility for @title', array('@title' => $extra_field['label'])),
'#title_display' => 'invisible',
'#options' => $this->getExtraFieldVisibilityOptions(),
'#default_value' => $display_options ? 'visible' : 'hidden',
'#parents' => array('fields', $field_id, 'type'),
'#attributes' => array('class' => array('field-plugin-type')),
),
),
'settings_summary' => array(),
'settings_edit' => array(),
);
return $extra_field_row;
}
Please login to continue.