Commit 8afff8c8 authored by alexpott's avatar alexpott
Browse files

Issue #2039709 by dawehner, swentel, MantasK | jurcello: Fixed Forward slash...

Issue #2039709 by dawehner, swentel, MantasK | jurcello: Fixed Forward slash in filter aliases in url alias overview doesn't work.
parent ddfd70a7
......@@ -16,7 +16,7 @@ path.admin_overview:
_permission: 'administer url aliases'
path.admin_overview_filter:
path: '/admin/config/search/path/list/{keys}'
path: '/admin/config/search/path/filter'
defaults:
_title: 'URL aliases'
_content: '\Drupal\path\Controller\PathController::adminOverview'
......
......@@ -12,6 +12,7 @@
use Drupal\Core\Path\AliasManagerInterface;
use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
/**
* Controller routines for path routes.
......@@ -55,7 +56,17 @@ public static function create(ContainerInterface $container) {
);
}
public function adminOverview($keys) {
/**
* Displays the path administration overview page.
*
* @param \Symfony\Component\HttpFoundation\Request $request
* The request object.
*
* @return array
* A render array as expected by drupal_render().
*/
public function adminOverview(Request $request) {
$keys = $request->query->get('search');
// Add the filter form above the overview table.
$build['path_admin_filter_form'] = $this->formBuilder()->getForm('Drupal\path\Form\PathFilterForm', $keys);
// Enable language column if language.module is enabled or if we have any
......
......@@ -60,8 +60,8 @@ public function buildForm(array $form, FormStateInterface $form_state, $keys = N
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$form_state->setRedirect('path.admin_overview_filter', array(
'keys' => trim($form_state->getValue('filter')),
$form_state->setRedirect('path.admin_overview_filter', array(), array(
'query' => array('search' => trim($form_state->getValue('filter'))),
));
}
......
......@@ -36,6 +36,7 @@ public function testPathFiltering() {
// Create test nodes.
$node1 = $this->drupalCreateNode();
$node2 = $this->drupalCreateNode();
$node3 = $this->drupalCreateNode();
// Create aliases.
$alias1 = $this->randomMachineName(8);
......@@ -52,6 +53,13 @@ public function testPathFiltering() {
);
$this->drupalPostForm('admin/config/search/path/add', $edit, t('Save'));
$alias3 = $this->randomMachineName(4) . '/' . $this->randomMachineName(4);
$edit = array(
'source' => 'node/' . $node3->id(),
'alias' => $alias3,
);
$this->drupalPostForm('admin/config/search/path/add', $edit, t('Save'));
// Filter by the first alias.
$edit = array(
'filter' => $alias1,
......@@ -59,6 +67,7 @@ public function testPathFiltering() {
$this->drupalPostForm(NULL, $edit, t('Filter'));
$this->assertLinkByHref($alias1);
$this->assertNoLinkByHref($alias2);
$this->assertNoLinkByHref($alias3);
// Filter by the second alias.
$edit = array(
......@@ -67,6 +76,16 @@ public function testPathFiltering() {
$this->drupalPostForm(NULL, $edit, t('Filter'));
$this->assertNoLinkByHref($alias1);
$this->assertLinkByHref($alias2);
$this->assertNoLinkByHref($alias3);
// Filter by the third alias which has a slash.
$edit = array(
'filter' => $alias3,
);
$this->drupalPostForm(NULL, $edit, t('Filter'));
$this->assertNoLinkByHref($alias1);
$this->assertNoLinkByHref($alias2);
$this->assertLinkByHref($alias3);
// Filter by a random string with a different length.
$edit = array(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment