protected function ViewsBulkOperationsFormTrait::addListData in Views Bulk Operations (VBO) 4.0.x
Same name and namespace in other branches
- 8.3 src/Form/ViewsBulkOperationsFormTrait.php \Drupal\views_bulk_operations\Form\ViewsBulkOperationsFormTrait::addListData()
Add data needed for entity list rendering.
2 calls to ViewsBulkOperationsFormTrait::addListData()
- ViewsBulkOperationsFormTrait::getFormData in src/
Form/ ViewsBulkOperationsFormTrait.php - Helper function to prepare data needed for proper form display.
- ViewsBulkOperationsFormTrait::getMultipageList in src/
Form/ ViewsBulkOperationsFormTrait.php - Build the selection info element.
File
- src/
Form/ ViewsBulkOperationsFormTrait.php, line 54
Class
- ViewsBulkOperationsFormTrait
- Defines common methods for Views Bulk Operations forms.
Namespace
Drupal\views_bulk_operations\FormCode
protected function addListData(&$form_data) {
$form_data['entity_labels'] = [];
if (!empty($form_data['list'])) {
$form_data['selected_count'] = count($form_data['list']);
if (!empty($form_data['exclude_mode'])) {
$form_data['selected_count'] = $form_data['total_results'] - $form_data['selected_count'];
}
// In case of exclude mode we still get excluded labels
// so we temporarily switch off exclude mode.
$modified_form_data = $form_data;
$modified_form_data['exclude_mode'] = FALSE;
$form_data['entity_labels'] = $this->actionProcessor
->getLabels($modified_form_data);
}
else {
$form_data['selected_count'] = $form_data['total_results'] ?? 0;
}
}