You are here

protected function FieldGroupTable::buildRowForm in Field Group Table 8

Build table row for a "form" context.

Parameters

array $element: Rendering array of an element.

Return value

array Table row for a "form" context.

1 call to FieldGroupTable::buildRowForm()
FieldGroupTable::buildRow in src/Plugin/field_group/FieldGroupFormatter/FieldGroupTable.php
Build table row for requested element.

File

src/Plugin/field_group/FieldGroupFormatter/FieldGroupTable.php, line 499

Class

FieldGroupTable
Plugin implementation of the 'field_group_table' formatter.

Namespace

Drupal\field_group_table\Plugin\field_group\FieldGroupFormatter

Code

protected function buildRowForm(array $element) {
  $title_data = $this
    ->getElementTitleData($element);
  $build = [];
  if ($title_data['title'] || $this
    ->getSetting('empty_label_behavior') == self::EMPTY_LABEL_KEEP) {
    if (!$this
      ->getSetting('always_show_field_label')) {
      $this
        ->hideElementTitle($element);
    }
    $build['data'] = [
      [
        'data' => [
          '#type' => 'item',
          '#title' => $title_data['title'],
          '#required' => $title_data['required'],
        ],
        'header' => TRUE,
      ],
      [
        'data' => $element,
      ],
    ];
  }
  else {
    $build['data'] = [
      [
        'data' => [
          $element,
        ],
        'colspan' => 2,
      ],
    ];
  }
  if (isset($element['widget'], $element['widget']['#field_name'])) {
    $build['class'][] = Html::cleanCssIdentifier($element['widget']['#field_name']);
  }
  return $build;
}