You are here

function _paragraphs_table_header in Paragraphs table 8

Get table header.

1 call to _paragraphs_table_header()
paragraphs_table_preprocess_field_multiple_value_form in ./paragraphs_table.module
Implements hook_preprocess_HOOK().

File

./paragraphs_table.module, line 170
Contains paragraphs_table.module.

Code

function _paragraphs_table_header($fields, $show_all = FALSE, $rowWeightCol = FALSE, $is_new = FALSE) {
  $header = empty($show_all) ? [
    '',
  ] : [];
  foreach ($fields as $field_name => $field) {
    $header[] = [
      'data' => $field
        ->getLabel(),
      'class' => [
        $field_name,
      ],
    ];
  }
  if (empty($show_all) && !$is_new) {
    $header[] = [
      'data' => '',
      'class' => [
        'action',
      ],
    ];
    $header[] = $rowWeightCol;
  }
  if ($is_new) {
    $header[0] = $header[1];
  }
  return $header;
}