Commit 255a33f5 authored by webchick's avatar webchick

Issue #1967124 by damiankloip, dawehner | xjm: Bulk action views array to...

Issue #1967124 by damiankloip, dawehner | xjm: Bulk action views array to string conversion when there are no results.
parent 39a0b439
......@@ -35,6 +35,11 @@ public static function getInfo() {
* Tests the bulk form.
*/
public function testBulkForm() {
// First, test an empty bulk form with the default style plugin to make sure
// the empty region is rendered correctly.
$this->drupalGet('test_bulk_form_empty');
$this->assertText(t('This view is empty.'), 'Empty text found on empty bulk form.');
$nodes = array();
for ($i = 0; $i < 10; $i++) {
// Ensure nodes are sorted in the same order they are inserted in the
......
......@@ -150,6 +150,27 @@ display:
position: null
display_options:
path: test_bulk_form
page_2:
display_plugin: page
id: page_2
display_title: Page
position: null
display_options:
path: test_bulk_form_empty
defaults:
style: false
empty: false
style:
type: default
empty:
area:
id: area
table: views
field: area
empty: true
content: 'This view is empty.'
plugin_id: text_custom
provider: views
base_field: nid
status: true
module: views
......
......@@ -133,8 +133,15 @@ function template_preprocess_views_view(&$variables) {
if (views_view_has_form_elements($view)) {
// Copy the rows so as not to modify them by reference when rendering.
$rows = $variables['rows'];
$rows = drupal_render($rows);
$output = !empty($rows) ? $rows : $variables['empty'];
// Only render row output if there are rows. Otherwise, render the empty
// region.
if (!empty($rows)) {
$output = drupal_render($rows);
}
else {
$empty = $variables['empty'];
$output = drupal_render($empty);
}
$container = \Drupal::getContainer();
$form_object = new ViewsForm($container->get('controller_resolver'), $container->get('url_generator'), $container->get('request'), $view->storage->id(), $view->current_display);
......
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