Issue #2154005 by olli: Views UI does not render preview for feeds.
parent
ae12caf9ea
commit
982ca4b590
|
@ -7,6 +7,7 @@
|
|||
|
||||
namespace Drupal\views\Plugin\views\display;
|
||||
|
||||
use Drupal\Component\Utility\String;
|
||||
use Drupal\views\ViewExecutable;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
@ -86,11 +87,17 @@ class Feed extends PathPluginBase {
|
|||
* Overrides \Drupal\views\Plugin\views\display\PathPluginBase::preview().
|
||||
*/
|
||||
public function preview() {
|
||||
$output = $this->view->render();
|
||||
|
||||
if (!empty($this->view->live_preview)) {
|
||||
return '<pre>' . check_plain($this->view->render()) . '</pre>';
|
||||
$output = array(
|
||||
'#prefix' => '<pre>',
|
||||
'#markup' => String::checkPlain($output),
|
||||
'#suffix' => '</pre>',
|
||||
);
|
||||
}
|
||||
|
||||
return $this->view->render();
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -77,6 +77,21 @@ class PreviewTest extends UITestBase {
|
|||
$this->assertText('Test header text', 'Rendered header text found');
|
||||
$this->assertText('Test footer text', 'Rendered footer text found.');
|
||||
$this->assertText('Test empty text', 'Rendered empty text found.');
|
||||
|
||||
// Test feed preview.
|
||||
$view = array();
|
||||
$view['label'] = $this->randomName(16);
|
||||
$view['id'] = strtolower($this->randomName(16));
|
||||
$view['page[create]'] = 1;
|
||||
$view['page[title]'] = $this->randomName(16);
|
||||
$view['page[path]'] = $this->randomName(16);
|
||||
$view['page[feed]'] = 1;
|
||||
$view['page[feed_properties][path]'] = $this->randomName(16);
|
||||
$this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit'));
|
||||
$this->clickLink(t('Feed'));
|
||||
$this->drupalPostForm(NULL, array(), t('Update preview'));
|
||||
$result = $this->xpath('//div[@id="views-live-preview"]/pre');
|
||||
$this->assertTrue(strpos($result[0], '<title>' . $view['page[title]'] . '</title>'), 'The Feed RSS preview was rendered.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue