You are here

public function SocialEventManagersViewsBulkOperationsBulkForm::viewsFormValidate in Open Social 10.2.x

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_event/modules/social_event_managers/src/Plugin/views/field/SocialEventManagersViewsBulkOperationsBulkForm.php \Drupal\social_event_managers\Plugin\views\field\SocialEventManagersViewsBulkOperationsBulkForm::viewsFormValidate()
  2. 8.5 modules/social_features/social_event/modules/social_event_managers/src/Plugin/views/field/SocialEventManagersViewsBulkOperationsBulkForm.php \Drupal\social_event_managers\Plugin\views\field\SocialEventManagersViewsBulkOperationsBulkForm::viewsFormValidate()
  3. 8.6 modules/social_features/social_event/modules/social_event_managers/src/Plugin/views/field/SocialEventManagersViewsBulkOperationsBulkForm.php \Drupal\social_event_managers\Plugin\views\field\SocialEventManagersViewsBulkOperationsBulkForm::viewsFormValidate()
  4. 8.7 modules/social_features/social_event/modules/social_event_managers/src/Plugin/views/field/SocialEventManagersViewsBulkOperationsBulkForm.php \Drupal\social_event_managers\Plugin\views\field\SocialEventManagersViewsBulkOperationsBulkForm::viewsFormValidate()
  5. 8.8 modules/social_features/social_event/modules/social_event_managers/src/Plugin/views/field/SocialEventManagersViewsBulkOperationsBulkForm.php \Drupal\social_event_managers\Plugin\views\field\SocialEventManagersViewsBulkOperationsBulkForm::viewsFormValidate()
  6. 10.3.x modules/social_features/social_event/modules/social_event_managers/src/Plugin/views/field/SocialEventManagersViewsBulkOperationsBulkForm.php \Drupal\social_event_managers\Plugin\views\field\SocialEventManagersViewsBulkOperationsBulkForm::viewsFormValidate()
  7. 10.0.x modules/social_features/social_event/modules/social_event_managers/src/Plugin/views/field/SocialEventManagersViewsBulkOperationsBulkForm.php \Drupal\social_event_managers\Plugin\views\field\SocialEventManagersViewsBulkOperationsBulkForm::viewsFormValidate()
  8. 10.1.x modules/social_features/social_event/modules/social_event_managers/src/Plugin/views/field/SocialEventManagersViewsBulkOperationsBulkForm.php \Drupal\social_event_managers\Plugin\views\field\SocialEventManagersViewsBulkOperationsBulkForm::viewsFormValidate()

Overrides ViewsBulkOperationsBulkForm::viewsFormValidate

File

modules/social_features/social_event/modules/social_event_managers/src/Plugin/views/field/SocialEventManagersViewsBulkOperationsBulkForm.php, line 258

Class

SocialEventManagersViewsBulkOperationsBulkForm
Defines the Enrollments Views Bulk Operations field plugin.

Namespace

Drupal\social_event_managers\Plugin\views\field

Code

public function viewsFormValidate(&$form, FormStateInterface $form_state) {
  if ($this->view
    ->id() === 'event_manage_enrollments') {
    $user_input = $form_state
      ->getUserInput();
    $available_options = $this
      ->getBulkOptions();

    // Grab all the actions that are available.
    foreach (Element::children($this->actions) as $action) {

      // If the option is not in our selected options, next.
      if (empty($available_options[$action])) {
        continue;
      }

      /** @var \Drupal\Core\StringTranslation\TranslatableMarkup $label */
      $label = $available_options[$action];

      // Match the Users action from our custom dropdown.
      // Find the action from the VBO selection.
      // And set that as the chosen action in the form_state.
      if (strip_tags($label
        ->render()) === $user_input['op']) {
        $user_input['action'] = $action;
        $form_state
          ->setUserInput($user_input);
        $form_state
          ->setValue('action', $action);
        $form_state
          ->setTriggeringElement($this->actions[$action]);
        break;
      }
    }
  }
  parent::viewsFormValidate($form, $form_state);
}