diff --git a/src/ChadoSearch/ChadoSearchPluginBase.php b/src/ChadoSearch/ChadoSearchPluginBase.php index afc97db..0056335 100644 --- a/src/ChadoSearch/ChadoSearchPluginBase.php +++ b/src/ChadoSearch/ChadoSearchPluginBase.php @@ -3,6 +3,7 @@ namespace Drupal\chado_search\ChadoSearch; use Drupal\chado_search\ChadoSearch\Interfaces\ChadoSearchInterface; +use Drupal\Core\Link; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Component\Plugin\PluginBase; use Drupal\Core\Form\FormState; @@ -300,11 +301,12 @@ public function addPager(array $form, int $num_results): array { $params = $query_params; $params['offset'] = $prev_offset; $params['page_num'] = $prev_page_num; - $left_arrow = l( + $route_name = 'chado_search.form.' . $this->id(); + $left_arrow = Link::createFromRoute( $left_arrow, - $this->urlPath(), + $route_name, + $params, [ - 'query' => $params, 'html' => TRUE, ] ); @@ -322,11 +324,12 @@ public function addPager(array $form, int $num_results): array { $params = $query_params; $params['offset'] = $next_offset; $params['page_num'] = $next_page_num; - $right_arrow = l( + $route_name = 'chado_search.form.' . $this->id(); + $right_arrow = Link::createFromRoute( $right_arrow, - $this->urlPath(), + $route_name, + $params, [ - 'query' => $params, 'html' => TRUE, ] ); @@ -334,9 +337,9 @@ public function addPager(array $form, int $num_results): array { $form['pager'] = [ '#type' => 'markup', - '#markup' => '' . $left_arrow . '' + '#markup' => '' . $left_arrow->toString() . '' . '' . ' - Page ' . $page_num . ' - ' . '' - . '' . $right_arrow . '', + . '' . $right_arrow->toString() . '', '#prefix' => '
', '#suffix' => '
', '#weight' => 100,