You are here

protected function EntityDisplayFormBase::buildExtraFieldRow in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 446
Contains \Drupal\field_ui\Form\EntityDisplayFormBase.

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;
}