You are here

public function SocialEventManagersViewsBulkOperationsBulkForm::viewsFormSubmit 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::viewsFormSubmit()
  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::viewsFormSubmit()
  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::viewsFormSubmit()
  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::viewsFormSubmit()
  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::viewsFormSubmit()
  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::viewsFormSubmit()
  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::viewsFormSubmit()
  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::viewsFormSubmit()

Submit handler for the bulk form.

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 ViewsBulkOperationsBulkForm::viewsFormSubmit

File

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

Class

SocialEventManagersViewsBulkOperationsBulkForm
Defines the Enrollments Views Bulk Operations field plugin.

Namespace

Drupal\social_event_managers\Plugin\views\field

Code

public function viewsFormSubmit(array &$form, FormStateInterface $form_state) {
  parent::viewsFormSubmit($form, $form_state);
  if ($form_state
    ->get('step') === 'views_form_views_form' && $this->view
    ->id() === 'event_manage_enrollments') {

    /** @var \Drupal\Core\Url $url */
    $url = $form_state
      ->getRedirect();
    if ($url
      ->getRouteName() === 'views_bulk_operations.execute_configurable') {
      $parameters = $url
        ->getRouteParameters();
      if (empty($parameters['node'])) {
        $node = \Drupal::routeMatch()
          ->getParameter('node');
        if ($node instanceof NodeInterface) {

          // You can get nid and anything else you need from the node object.
          $parameters['node'] = $node
            ->id();
        }
        elseif (!is_object($node)) {
          $parameters['node'] = $node;
        }
      }
      $url = Url::fromRoute('social_event_managers.vbo.execute_configurable', [
        'node' => $parameters['node'],
      ]);
      $form_state
        ->setRedirectUrl($url);
    }
  }
}