You are here

public function OgMembershipBulkForm::viewsForm in Organic groups 8

Provide a more useful title to improve the accessibility.

Overrides BulkForm::viewsForm

File

src/Plugin/views/field/OgMembershipBulkForm.php, line 23

Class

OgMembershipBulkForm
Defines a user operations bulk form element.

Namespace

Drupal\og\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) {
      $membership = $result->_entity;
      if ($membership instanceof OgMembershipInterface) {
        $form[$this->options['id']][$row_index]['#title'] = $this
          ->t('Update the member @name', [
          '@name' => $membership
            ->getOwner()
            ->getAccountName(),
        ]);
      }
    }
  }
}