You are here

protected function FieldGroupTable::buildRow in Field Group Table 8

Build table row for requested element.

Parameters

array $element: Rendering array of an element.

string $field_name: The name of currently handling field.

Return value

array Table row definition on success or an empty array otherwise.

1 call to FieldGroupTable::buildRow()
FieldGroupTable::preRender in src/Plugin/field_group/FieldGroupFormatter/FieldGroupTable.php

File

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

Class

FieldGroupTable
Plugin implementation of the 'field_group_table' formatter.

Namespace

Drupal\field_group_table\Plugin\field_group\FieldGroupFormatter

Code

protected function buildRow(array $element, $field_name) {
  $item = $this
    ->getRowItem($element, $field_name);
  $build = [];
  if (!$item) {
    return $build;
  }
  switch ($this->context) {
    case 'view':
      $build = $this
        ->buildRowView($item);
      break;
    case 'form':
      $build = $this
        ->buildRowForm($item);
      break;
  }
  $build['class'][] = 'table-row';
  $build['no_striping'] = !$this
    ->getSetting('table_row_striping');
  return $build;
}