Commit b327840d authored by catch's avatar catch

Issue #2826268 by Lendude, LoMo, dawehner: Don't fatal on rss feeds when the...

Issue #2826268 by Lendude, LoMo, dawehner: Don't fatal on rss feeds when the page display is disabled
parent 5184e99d
......@@ -149,4 +149,24 @@ public function testDisabledFeed() {
$this->assertResponse(404);
}
/**
* Tests that the feed display works when the linked display is disabled.
*/
public function testDisabledLinkedDisplay() {
$view = Views::getView('test_attached_disabled');
$view->setDisplay();
// Disable the page and link the feed to the page.
$view->displayHandlers->get('feed_1')->setOption('link_display', 'page_1');
$view->displayHandlers->get('page_1')->setOption('enabled', FALSE);
$view->save();
\Drupal::service('router.builder')->rebuild();
$this->drupalGet('test-attached-disabled');
$this->assertResponse(404);
// Ensure the feed can still be reached.
$this->drupalGet('test-attached-disabled.xml');
$this->assertResponse(200);
}
}
......@@ -858,12 +858,13 @@ function template_preprocess_views_view_rss(&$variables) {
// Figure out which display which has a path we're using for this feed. If
// there isn't one, use the global $base_url
$link_display_id = $view->display_handler->getLinkDisplay();
if ($link_display_id && $display = $view->displayHandlers->get($link_display_id)) {
/** @var \Drupal\views\Plugin\views\display\DisplayPluginBase $display */
if ($link_display_id && ($display = $view->displayHandlers->get($link_display_id)) && $display->isEnabled()) {
$url = $view->getUrl(NULL, $link_display_id);
}
/** @var \Drupal\Core\Url $url */
if ($url) {
if (!empty($url)) {
$url_options = ['absolute' => TRUE];
if (!empty($view->exposed_raw_input)) {
$url_options['query'] = $view->exposed_raw_input;
......
Markdown is supported
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