3 namespace Drupal\user\Plugin\views\field;
5 use Drupal\Core\Form\FormStateInterface;
6 use Drupal\system\Plugin\views\field\BulkForm;
7 use Drupal\user\UserInterface;
10 * Defines a user operations bulk form element.
12 * @ViewsField("user_bulk_form")
14 class UserBulkForm extends BulkForm {
19 * Provide a more useful title to improve the accessibility.
21 public function viewsForm(&$form, FormStateInterface $form_state) {
22 parent::viewsForm($form, $form_state);
24 if (!empty($this->view->result)) {
25 foreach ($this->view->result as $row_index => $result) {
26 $account = $result->_entity;
27 if ($account instanceof UserInterface) {
28 $form[$this->options['id']][$row_index]['#title'] = $this->t('Update the user %name', ['%name' => $account->label()]);
37 protected function emptySelectedMessage() {
38 return $this->t('No users selected.');