Commit 57fb699b authored by alexpott's avatar alexpott

Issue #2549719 by dawehner: View::preRenderViewElement should use $element['view_build'] always

parent b1fbb049
......@@ -58,7 +58,7 @@ public static function preRenderViewElement($element) {
if ($view && $view->access($element['#display_id'])) {
if (!empty($element['#embed'])) {
$element += $view->preview($element['#display_id'], $element['#arguments']);
$element['view_build'] = $view->preview($element['#display_id'], $element['#arguments']);
}
else {
// Add contextual links to the view. We need to attach them to the dummy
......
......@@ -127,7 +127,7 @@ public function testViewElementEmbed() {
// Set the content as our rendered array.
$render = $this->render;
$render['#embed'] = TRUE;
$render['view']['#embed'] = TRUE;
$this->setRawContent($renderer->renderRoot($render));
$xpath = $this->xpath('//div[@class="views-element-container"]');
......@@ -173,7 +173,7 @@ public function testViewElementEmbed() {
// Test the render array again.
$render = $this->render;
$render['#embed'] = TRUE;
$render['view']['#embed'] = TRUE;
$this->setRawContent($renderer->renderRoot($render));
// There should be 1 row in the results, 'John' arg 25.
$xpath = $this->xpath('//div[@class="view-content"]/div');
......@@ -183,6 +183,15 @@ public function testViewElementEmbed() {
$this->drupalGet('views_test_data_element_embed_form');
$xpath = $this->xpath('//div[@class="view-content"]/div');
$this->assertEqual(count($xpath), 1);
// Tests the render array with an exposed filter.
$render = $this->render;
$render['view']['#display_id'] = 'embed_2';
$render['view']['#embed'] = TRUE;
$this->setRawContent($renderer->renderRoot($render));
// Ensure that the exposed form is rendered.
$this->assertEqual(1, count($this->xpath('//form[@class="views-exposed-form"]')));
}
}
......@@ -59,3 +59,40 @@ display:
display_title: Embedded
id: embed_1
position: 1
embed_2:
display_options:
defaults:
filters: false
exposed_form: false
exposed_form:
type: basic
options:
submit_button: Filter
reset_button: true
reset_button_label: Reset
exposed_sorts_label: 'Sort by'
expose_sort_order: true
sort_asc_label: Asc
sort_desc_label: Desc
filters:
id:
field: id
id: id
relationship: none
table: views_test_data
plugin_id: numeric
exposed: true
expose:
operator_id: ''
label: Id
description: ''
identifier: id
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
display_plugin: embed
display_title: Embedded
id: embed_2
position: 2
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