function UserBulkForm::viewsForm

Same name in other branches
  1. 9 core/modules/user/src/Plugin/views/field/UserBulkForm.php \Drupal\user\Plugin\views\field\UserBulkForm::viewsForm()
  2. 8.9.x core/modules/user/src/Plugin/views/field/UserBulkForm.php \Drupal\user\Plugin\views\field\UserBulkForm::viewsForm()
  3. 10 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(),
                ]);
            }
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.