You are here

protected function TFTController::content_table in Taxonomy File Tree 8

Same name and namespace in other branches
  1. 3.x src/Controller/TFTController.php \Drupal\tft\Controller\TFTController::content_table()

Get the folder content in HTML table form.

Return value

array The render array.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

1 call to TFTController::content_table()
TFTController::ajaxGetFolder in src/Controller/TFTController.php
Returns folder.

File

src/Controller/TFTController.php, line 313

Class

TFTController
Class TFTController.

Namespace

Drupal\tft\Controller

Code

protected function content_table($tid, $gid = NULL) {
  $headers = [
    [
      'id' => 'table-th-name',
      'data' => $this
        ->t('Name'),
    ],
    [
      'id' => 'table-th-loaded-by',
      'data' => $this
        ->t('Loaded by'),
    ],
    [
      'id' => 'table-th-date',
      'data' => $this
        ->t('Last modified'),
    ],
    [
      'id' => 'table-th-type',
      'data' => $this
        ->t('Type'),
    ],
    [
      'id' => 'table-th-ops',
      'data' => $this
        ->t('Operations'),
    ],
  ];
  return [
    [
      '#type' => 'container',
      '#attributes' => [
        'class' => [
          'table-responsive',
        ],
      ],
      'table' => [
        '#type' => 'table',
        '#header' => $headers,
        '#rows' => $this
          ->get_content($tid, $gid),
      ],
    ],
    $this
      ->add_content_links($tid, $gid),
  ];
}