Loading core/lib/Drupal/Core/Path/PathMatcher.php +1 −1 Original line number Diff line number Diff line Loading @@ -112,7 +112,7 @@ protected function getFrontPagePath() { // Lazy-load front page config. if (!isset($this->frontPage)) { $this->frontPage = $this->configFactory->get('system.site') ->get('page.front'); ->get('page.front') ?? ''; } return $this->frontPage; } Loading core/modules/system/src/Form/SiteInformationForm.php +2 −1 Original line number Diff line number Diff line Loading @@ -128,10 +128,11 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#title' => $this->t('Front page'), '#open' => TRUE, ]; $frontPage = $site_config->get('page.front'); $form['front_page']['site_frontpage'] = [ '#type' => 'textfield', '#title' => $this->t('Default front page'), '#default_value' => $this->aliasManager->getAliasByPath($site_config->get('page.front')), '#default_value' => $frontPage ? $this->aliasManager->getAliasByPath($frontPage) : '', '#required' => TRUE, '#size' => 40, '#description' => $this->t('Specify a relative URL to display as the front page.'), Loading core/modules/system/tests/src/Functional/System/FrontPageTest.php +5 −0 Original line number Diff line number Diff line Loading @@ -95,6 +95,11 @@ public function testDrupalFrontPage(): void { $this->assertSession()->pageTextNotContains('On front page.'); $this->drupalGet($this->nodePath); $this->assertSession()->pageTextContains('On front page.'); // Test the form when page.front is null. $this->config('system.site')->clear('page.front')->save(); $this->drupalGet('admin/config/system/site-information'); $this->assertSession()->statusCodeEquals(200); } } core/tests/Drupal/Tests/Core/Path/PathMatcherTest.php +16 −0 Original line number Diff line number Diff line Loading @@ -51,6 +51,22 @@ public function testMatchPath($patterns, $paths): void { } } /** * Tests matchPath when page.front is null. */ public function testMatchPathNullFront(): void { $config_factory_stub = $this->getConfigFactoryStub( [ 'system.site' => [ 'page.front' => NULL, ], ] ); $route_match = $this->createMock('Drupal\Core\Routing\RouteMatchInterface'); $pathMatcher = new PathMatcher($config_factory_stub, $route_match); $this->assertTrue($pathMatcher->matchPath('/foo', '/*')); } /** * Provides test path data. * Loading Loading
core/lib/Drupal/Core/Path/PathMatcher.php +1 −1 Original line number Diff line number Diff line Loading @@ -112,7 +112,7 @@ protected function getFrontPagePath() { // Lazy-load front page config. if (!isset($this->frontPage)) { $this->frontPage = $this->configFactory->get('system.site') ->get('page.front'); ->get('page.front') ?? ''; } return $this->frontPage; } Loading
core/modules/system/src/Form/SiteInformationForm.php +2 −1 Original line number Diff line number Diff line Loading @@ -128,10 +128,11 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#title' => $this->t('Front page'), '#open' => TRUE, ]; $frontPage = $site_config->get('page.front'); $form['front_page']['site_frontpage'] = [ '#type' => 'textfield', '#title' => $this->t('Default front page'), '#default_value' => $this->aliasManager->getAliasByPath($site_config->get('page.front')), '#default_value' => $frontPage ? $this->aliasManager->getAliasByPath($frontPage) : '', '#required' => TRUE, '#size' => 40, '#description' => $this->t('Specify a relative URL to display as the front page.'), Loading
core/modules/system/tests/src/Functional/System/FrontPageTest.php +5 −0 Original line number Diff line number Diff line Loading @@ -95,6 +95,11 @@ public function testDrupalFrontPage(): void { $this->assertSession()->pageTextNotContains('On front page.'); $this->drupalGet($this->nodePath); $this->assertSession()->pageTextContains('On front page.'); // Test the form when page.front is null. $this->config('system.site')->clear('page.front')->save(); $this->drupalGet('admin/config/system/site-information'); $this->assertSession()->statusCodeEquals(200); } }
core/tests/Drupal/Tests/Core/Path/PathMatcherTest.php +16 −0 Original line number Diff line number Diff line Loading @@ -51,6 +51,22 @@ public function testMatchPath($patterns, $paths): void { } } /** * Tests matchPath when page.front is null. */ public function testMatchPathNullFront(): void { $config_factory_stub = $this->getConfigFactoryStub( [ 'system.site' => [ 'page.front' => NULL, ], ] ); $route_match = $this->createMock('Drupal\Core\Routing\RouteMatchInterface'); $pathMatcher = new PathMatcher($config_factory_stub, $route_match); $this->assertTrue($pathMatcher->matchPath('/foo', '/*')); } /** * Provides test path data. * Loading