You are here

private function Instances::render in Smart Date 3.x

Same name and namespace in other branches
  1. 8.2 modules/smart_date_recur/src/Controller/Instances.php \Drupal\smart_date_recur\Controller\Instances::render()
  2. 3.0.x modules/smart_date_recur/src/Controller/Instances.php \Drupal\smart_date_recur\Controller\Instances::render()
  3. 3.1.x modules/smart_date_recur/src/Controller/Instances.php \Drupal\smart_date_recur\Controller\Instances::render()
  4. 3.2.x modules/smart_date_recur/src/Controller/Instances.php \Drupal\smart_date_recur\Controller\Instances::render()
  5. 3.3.x modules/smart_date_recur/src/Controller/Instances.php \Drupal\smart_date_recur\Controller\Instances::render()
  6. 3.4.x modules/smart_date_recur/src/Controller/Instances.php \Drupal\smart_date_recur\Controller\Instances::render()

Builds the render array for the listings.

Parameters

array $instances: The data for instances to list.

Return value

array A render array of the list and appropriate actions.

See also

\Drupal\Core\Entity\EntityListBuilder::render()

1 call to Instances::render()
Instances::listInstancesOutput in modules/smart_date_recur/src/Controller/Instances.php
Provide a list of rule items with operations to change rule items.

File

modules/smart_date_recur/src/Controller/Instances.php, line 156

Class

Instances
Provides listings of instances (with overrides) for a specified rule.

Namespace

Drupal\smart_date_recur\Controller

Code

private function render(array $instances) {
  if ($this->updateButton) {
    $build['action'] = $this
      ->buildUpdateButton();
  }
  $build['table'] = [
    '#type' => 'table',
    '#attributes' => [
      'id' => 'manage-instances',
    ],
    '#header' => $this
      ->buildHeader(),
    '#rows' => [],
    '#empty' => $this
      ->t('There are no @label yet.', [
      '@label' => 'recurring instances',
    ]),
  ];
  foreach ($instances as $index => $instance) {
    if ($row = $this
      ->buildRow($instance)) {
      $build['table']['#rows'][$index] = $row;
    }
  }
  $build['table']['#attached']['library'][] = 'smart_date_recur/smart_date_recur';
  return $build;
}