protected function PullForm::pagerRedirect in Entity Share 8.3
Same name and namespace in other branches
- 8 modules/entity_share_client/src/Form/PullForm.php \Drupal\entity_share_client\Form\PullForm::pagerRedirect()
- 8.2 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.
1 call to PullForm::pagerRedirect()
- PullForm::goToPage in modules/
entity_share_client/ src/ Form/ PullForm.php - Form submission handler to go to pager link: first, previous, next, last.
File
- modules/
entity_share_client/ src/ Form/ PullForm.php, line 810
Class
- PullForm
- Form controller to pull entities.
Namespace
Drupal\entity_share_client\FormCode
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'])) {
$additional_query_parameters = [
'offset' => $parsed_url['query']['page']['offset'],
'order' => $this->query
->get('order', ''),
'sort' => $this->query
->get('sort', ''),
];
$this
->setFormRedirect($form_state, $additional_query_parameters);
}
}
}