You are here

protected function PullForm::pagerRedirect in Entity Share 8.2

Same name and namespace in other branches
  1. 8.3 modules/entity_share_client/src/Form/PullForm.php \Drupal\entity_share_client\Form\PullForm::pagerRedirect()
  2. 8 modules/entity_share_client/src/Form/PullForm.php \Drupal\entity_share_client\Form\PullForm::pagerRedirect()

Helper function to redirect with the form to right page to handle pager.

Parameters

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

string $link_name: The link name. Possibles values: first, prev, next, last.

4 calls to PullForm::pagerRedirect()
PullForm::firstPage in modules/entity_share_client/src/Form/PullForm.php
Form submission handler to go to the first pager page.
PullForm::lastPage in modules/entity_share_client/src/Form/PullForm.php
Form submission handler to go to the last pager page.
PullForm::nextPage in modules/entity_share_client/src/Form/PullForm.php
Form submission handler to go to the next pager page.
PullForm::prevPage in modules/entity_share_client/src/Form/PullForm.php
Form submission handler to go to the previous pager page.

File

modules/entity_share_client/src/Form/PullForm.php, line 806

Class

PullForm
Form controller to pull entities.

Namespace

Drupal\entity_share_client\Form

Code

protected function pagerRedirect(FormStateInterface $form_state, $link_name) {
  $storage = $form_state
    ->getStorage();
  if (isset($storage['links'][$link_name]['href'])) {
    $parsed_url = UrlHelper::parse($storage['links'][$link_name]['href']);
    if (isset($parsed_url['query']['page']) && isset($parsed_url['query']['page']['offset'])) {
      $form_state
        ->setRedirect('entity_share_client.admin_content_pull_form', [], [
        'query' => [
          'remote' => $form_state
            ->getValue('remote'),
          'channel' => $form_state
            ->getValue('channel'),
          'offset' => $parsed_url['query']['page']['offset'],
          'search' => $form_state
            ->getValue('search'),
          'order' => $this->query
            ->get('order', ''),
          'sort' => $this->query
            ->get('sort', ''),
        ],
      ]);
    }
  }
}