You are here

protected function ViewsBulkOperationsFormTrait::getListRenderable in Views Bulk Operations (VBO) 8.3

Same name and namespace in other branches
  1. 4.0.x src/Form/ViewsBulkOperationsFormTrait.php \Drupal\views_bulk_operations\Form\ViewsBulkOperationsFormTrait::getListRenderable()

Build selected entities list renderable.

Parameters

array $form_data: Data needed for this form.

Return value

array Renderable list array.

3 calls to ViewsBulkOperationsFormTrait::getListRenderable()
ConfigureAction::buildForm in src/Form/ConfigureAction.php
Form constructor.
ConfirmAction::buildForm in src/Form/ConfirmAction.php
Form constructor.
ViewsBulkOperationsFormTrait::getMultipageList in src/Form/ViewsBulkOperationsFormTrait.php
Build the selection info element.

File

src/Form/ViewsBulkOperationsFormTrait.php, line 112

Class

ViewsBulkOperationsFormTrait
Defines common methods for Views Bulk Operations forms.

Namespace

Drupal\views_bulk_operations\Form

Code

protected function getListRenderable(array $form_data) {
  $renderable = [
    '#theme' => 'item_list',
    '#items' => $form_data['entity_labels'],
    '#empty' => $this
      ->t('No items'),
  ];
  if (!empty($form_data['entity_labels'])) {
    $more = count($form_data['list']) - count($form_data['entity_labels']);
    if ($more > 0) {
      $renderable['#items'][] = [
        '#children' => $this
          ->t('..plus @count more..', [
          '@count' => $more,
        ]),
        '#wrapper_attributes' => [
          'class' => [
            'more',
          ],
        ],
      ];
    }
    $renderable['#title'] = $this
      ->getSelectionInfoTitle($form_data);
  }
  elseif (!empty($form_data['exclude_mode'])) {
    $renderable['#empty'] = $this
      ->t('Action will be executed on all items in the view.');
  }
  $renderable['#wrapper_attributes'] = [
    'class' => [
      'vbo-info-list-wrapper',
    ],
  ];
  return $renderable;
}