You are here

public function Counter::viewPager in Field Slideshow 8.3

Function render pager.

Parameters

\Drupal\Core\Field\FieldItemListInterface $items: List of items.

Return value

array Rendered array.

Overrides FieldSlideshowPagerPluginBase::viewPager

File

src/Plugin/FieldSlideshowPager/Counter.php, line 28

Class

Counter
Plugin implementation of the field_slideshow_pager.

Namespace

Drupal\field_slideshow\Plugin\FieldSlideshowPager

Code

public function viewPager(FieldItemListInterface $items) {
  $output = [];
  foreach ($items as $delta => $item) {
    $output[$delta] = [
      '#type' => 'html_tag',
      '#tag' => 'span',
      '#attributes' => [
        'class' => [
          'cycle-pager-item',
          'cycle-pager-item-' . ($delta + 1),
        ],
      ],
      '#value' => $delta + 1,
    ];
  }
  return $output;
}