You are here

protected function EditorNoteHelperService::generateHeaders in Editor Notes 8

Helper to prepare headers for the table.

Parameters

bool $widget: Determines whether to use function in widget along with controls or display it in formatter as just a table without controls.

Return value

array Headers data for the table.

1 call to EditorNoteHelperService::generateHeaders()
EditorNoteHelperService::generateTable in src/EditorNoteHelperService.php
Returns formatted notes table.

File

src/EditorNoteHelperService.php, line 345

Class

EditorNoteHelperService
Class EditorNoteHelperService.

Namespace

Drupal\editor_note

Code

protected function generateHeaders($widget) {
  $headers = [
    [
      'data' => $this
        ->t('Notes'),
      'class' => [
        'field-label',
      ],
    ],
    [
      'data' => $this
        ->t('Updated by'),
      'class' => [
        'field-author',
      ],
    ],
    [
      'data' => $this
        ->t('Changed'),
      'class' => [
        'field-changed',
      ],
    ],
    [
      'data' => $this
        ->t('Created'),
      'class' => [
        'field-created',
      ],
    ],
  ];
  if ($widget) {
    $headers[] = [
      'data' => $this
        ->t('Actions'),
      'class' => [
        'field-operations',
      ],
    ];
  }
  return $headers;
}