You are here

public function UserBulkForm::viewsForm in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/user/src/Plugin/views/field/UserBulkForm.php \Drupal\user\Plugin\views\field\UserBulkForm::viewsForm()
  2. 9 core/modules/user/src/Plugin/views/field/UserBulkForm.php \Drupal\user\Plugin\views\field\UserBulkForm::viewsForm()

Provide a more useful title to improve the accessibility.

Overrides BulkForm::viewsForm

File

core/modules/user/src/Plugin/views/field/UserBulkForm.php, line 21

Class

UserBulkForm
Defines a user operations bulk form element.

Namespace

Drupal\user\Plugin\views\field

Code

public function viewsForm(&$form, FormStateInterface $form_state) {
  parent::viewsForm($form, $form_state);
  if (!empty($this->view->result)) {
    foreach ($this->view->result as $row_index => $result) {
      $account = $result->_entity;
      if ($account instanceof UserInterface) {
        $form[$this->options['id']][$row_index]['#title'] = $this
          ->t('Update the user %name', [
          '%name' => $account
            ->label(),
        ]);
      }
    }
  }
}