Comments

dawehner’s picture

Status: Active » Needs review
StatusFileSize
new546 bytes

Here is a patch.

dawehner’s picture

Component: Documentation » Code

bazinga

damiankloip’s picture

StatusFileSize
new856 bytes

I think the logic in the render function needs to be changed too as $empty should be TRUE?

damiankloip’s picture

Project: VDC » Views (for Drupal 7)
Version: » 8.x-3.x-dev

Moving back to views for testing.

Status: Needs review » Needs work

The last submitted patch, 1807624-3.patch, failed testing.

dawehner’s picture

+++ b/core/modules/views/lib/Drupal/views/Plugin/views/area/TextCustom.phpundefined
@@ -40,7 +40,7 @@ public function submitOptionsForm(&$form, &$form_state) {
+    if ($empty || !empty($this->options['empty'])) {

Mh, this logik seems to be wrong for not-empty areas. You want to show them if !empty, see #1677784: $empty argument of the area handler render() is FALSE for the empty area. for more related data.

damiankloip’s picture

hmm, yeah I see what you mean. So the logic is pretty weird there really; we are relying on the actual $empty value to be FALSE for headers/footers and only the option being set to show actual empty text.

So atm, the empty text being rendered is dependent on this:

if ($this->definition['plugin_type'] == 'empty') {
  $this->options['empty'] = TRUE;
}

So this will never get set to TRUE, because the plugin_type will always be 'area' and not empty.

damiankloip’s picture

StatusFileSize
new1.85 KB

If we change the conditional in init to check the handler_type and not the definition, I think it works as it should. I also added the same conditional that we are using in the render methods into the TestExample handler too, as the tests weren't picking up that this wasn't working before.

The logic is still quite confusing, we should review this and maybe base it more on the handler_type that gets passed in for areas instead?

damiankloip’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 1807624-8.patch, failed testing.

damiankloip’s picture

Status: Needs work » Needs review
StatusFileSize
new3.69 KB

Ok, new patch. Changed a few other things...

  • Checked that handler_type isset, it might not be I guess (especially in the UI maybe).
  • Added empty = TRUE to options on the area handlers in the tests. The view returns no results, so this was totally not working before :)
  • Changed the logic in renderHeader and renderFooter methods on displayPluginBase as they were doing $empty = !empty($this->view->result), I think this needs to be the other way around.
dawehner’s picture

Status: Needs review » Reviewed & tested by the community
Checked that handler_type isset, it might not be I guess (especially in the UI maybe).

Yeah this could be the case if something is using views_get_handler directly.

+++ b/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.phpundefined
@@ -2442,7 +2442,7 @@ abstract class DisplayPluginBase extends PluginBase {
+    $empty = empty($this->view->result);

@@ -2450,12 +2450,12 @@ abstract class DisplayPluginBase extends PluginBase {
+    $empty = empty($this->view->result);
...
+    return $this->renderArea('empty', TRUE);

I guess this should be backported ...

damiankloip’s picture

StatusFileSize
new898 bytes

Not sure what else we need to include on the d7 port?

dawehner’s picture

Maybe also the isset, we never know

damiankloip’s picture

StatusFileSize
new1.37 KB

Yeah, might as well.

damiankloip’s picture

Title: Saving of global: unfiltered text does not work » Saving and rendering in empty region for 'Global: unfiltered' text does not work
tim.plunkett’s picture

StatusFileSize
new3.55 KB
new1.5 KB

Splitting them up just to be sure, will commit if it comes out as expected.

tim.plunkett’s picture

Status: Reviewed & tested by the community » Fixed
dawehner’s picture

Version: 8.x-3.x-dev » 7.x-3.x-dev
Status: Fixed » Needs review
damiankloip’s picture

Patch in #15 is the D7 one.

dawehner’s picture

Ups right

dawehner’s picture

Issue tags: -VDC

Remove the VDC tag

damiankloip’s picture

StatusFileSize
new1.37 KB

Let's test the D7 version.

dawehner’s picture

Could we port the tests to d7 as well?

chris matthews’s picture

Issue summary: View changes
Status: Needs review » Needs work
Issue tags: +Needs reroll

The 6 year old patch at #23 to views_handler_area.inc and views_plugin_display.inc does not apply to the latest views 7.x-3.x-dev and if still applicable needs to be rerolled.

Checking patch handlers/views_handler_area.inc...
error: while searching for:
   */
  function init(&$view, &$options) {
    parent::init($view, $options);
    if ($this->handler_type == 'empty') {
      $this->options['empty'] = TRUE;
    }
  }

error: patch failed: handlers/views_handler_area.inc:27
error: handlers/views_handler_area.inc: patch does not apply
Checking patch plugins/views_plugin_display.inc...
error: while searching for:
   * Render the header of the view.
   */
  function render_header() {
    $empty = !empty($this->view->result);
    return $this->render_area('header', $empty);
  }

error: patch failed: plugins/views_plugin_display.inc:2568
error: plugins/views_plugin_display.inc: patch does not apply
jigish.addweb’s picture

StatusFileSize
new1.52 KB

@Chris Matthews, Please review this rerolled patch & share your feedback on the same.

Thanks!..

jigish.addweb’s picture

Status: Needs work » Needs review
damienmckenna’s picture

Issue tags: -Needs reroll
guypaddock’s picture

Looks like there's a typo in the render_footer() method of #26 -- a double dollar-sign (i.e. $$empty).

Attached is a revised patch that's the same as #26, but with the typo fixed.

Can we get this in? We need this for unfiltered text to work on a view that should only display a header when the view is not empty :)