function UserBulkForm::viewsForm
Provide a more useful title to improve the accessibility.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
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\fieldCode
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.