Problem/Motivation

On #1957214: Title setting in views UI does not indicate when the title might be overridden, all the Views maintainers agree that handling an empty view (no results) is really not an "advanced" functionality. It's at least as common to configure this as it is to add headers and footers to the view.

Proposed resolution

Move it to the second column, after the header and footer sections. Patch in #16 implements this.

screenshot

Remaining tasks

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

xjm’s picture

It might actually make sense to move above the header and footer.

dawehner’s picture

My spontaneous guess would have been: put it into the middle between header and footer.

xjm’s picture

Dealer's choice.
no_results_before_header.png

no_results_after_footer.png

xjm’s picture

FileSize
77.79 KB
1.62 KB

Haha, one of the three.
between.png

dawehner’s picture

I wanna have a drag and drop to configure the views UI!

xjm’s picture

Hahaha :D

Alright, so let's decide: Do we want the "no results" before, between, or after header & footer?

damiankloip’s picture

My vote is for after the header and footer.

dawehner’s picture

My vote is: Not before header/footer.

damiankloip’s picture

Looks like we are agreeing then, good news :)

xjm’s picture

FileSize
1.67 KB

Then the lucky winner is...
no_results_after_footer.png

This also seems the best to me, actually.

Bojhan’s picture

Just wondering, for argument sake - why is it common functionality, and/or why was it thought initially not to be common functionality?

damiankloip’s picture

+++ b/core/modules/views/views_ui/lib/Drupal/views_ui/ViewEditFormController.phpundefined
@@ -525,11 +526,11 @@ public function getDisplayDetails($view, $display) {
+    $build['columns']['second']['empty'] = $this->getFormBucket($view, 'empty', $display);

Move this into the right order, below the header and footer, then we've got a deal!

Also. I'm not sure we need to declare all of the column arrays first, then add data to them after. I think we could keep the array order and not do that. That is definitely not to do with this issue though.

damiankloip’s picture

@Bojhan, I would say the empty area is possibly the most used of all the area types (header, footer, empty). I'm not sure about why that decision was made when the views UI was redesigned for views 3, so I can't shed light on that I'm afraid. Daniel will know more about that I think.

tim.plunkett’s picture

It's become best practice to add an empty area handler to every page view, for example, saying "There are no upcoming events." or something to that effect. It is less common for blocks. But I completely agree it should be in the second column.

damiankloip’s picture

Good point, this does promote a better practice for view building.

xjm’s picture

FileSize
1.25 KB
1.49 KB

Move this into the right order, below the header and footer, then we've got a deal!

Oops.

+1 that it is a best practice in most cases for page displays.

xjm’s picture

Issue summary: View changes

Updated issue summary.

xjm’s picture

Issue summary: View changes

Updated issue summary.

Bojhan’s picture

Status: Needs review » Reviewed & tested by the community

Cool, I never understood why it was this way either :)

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Makes sense to me, too, and I agree after header/footer makes more sense.

Committed and pushed to 8.x. Thanks!

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Updated issue summary.