Problem/Motivation

While working on #2339921: Undefined variable: groups in \Drupal\views\Plugin\views\filter\FilterPluginBase::groupForm I uncovered a new bug: After adding the or group relation to filters in a group, the edit link for the upper filters are not rendered properly.

Steps to reproduce:
- Add a view and add two filters.
- Click "And/or rearrange" and choose the "or" relation.
- Click "Apply"

Proposed resolution

Fix it.

Remaining tasks

Write a test.

User interface changes

Make it work again.

API changes

None.

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue category Bug because markup is broken
Unfrozen changes Unfrozen because it only fixes markup to make the functionallity work again

CommentFileSizeAuthor
#25 interdiff.txt745 bytesAnonymous (not verified)
#25 views_filter_formatting-2432759-25.patch4.19 KBAnonymous (not verified)
#19 views_filter_formatting-2432759-17.patch4.18 KBAnonymous (not verified)
#19 views_filter_formatting-2432759-17.test-fail.patch3.29 KBAnonymous (not verified)
#17 searches_for_words_with-731298-45.patch7.5 KBAnonymous (not verified)
#17 searches_for_words_with-731298-45.test-fail.patch3.12 KBAnonymous (not verified)
#15 after_patch.png55.97 KBkoence
#15 before_patch.png135.87 KBkoence
#13 views_filter_formatting-2432759-13.patch4.29 KBAnonymous (not verified)
#13 views_filter_formatting-2432759-13.test-fail.patch3.29 KBAnonymous (not verified)
#9 views_filter_formatting-2432759-9.patch4.06 KBAnonymous (not verified)
#9 views_filter_formatting-2432759-9.test-fail.patch3.29 KBAnonymous (not verified)
#5 views_filter_formatting-2432759-5.patch4.32 KBAnonymous (not verified)
#5 views_filter_formatting-2432759-5.test-only.patch3.31 KBAnonymous (not verified)
#2 views_filter_formatting-2432759-2.patch3.31 KBAnonymous (not verified)
2339921_filter_display_bug.png146.33 KBAnonymous (not verified)

Comments

Anonymous’s picture

Issue summary: View changes
Anonymous’s picture

Status: Active » Needs review
StatusFileSize
new3.31 KB

This test demonstrates the issue.

Status: Needs review » Needs work

The last submitted patch, 2: views_filter_formatting-2432759-2.patch, failed testing.

Anonymous’s picture

Assigned: Unassigned »
Anonymous’s picture

Assigned: » Unassigned
Status: Needs work » Needs review
Issue tags: -Needs tests
StatusFileSize
new3.31 KB
new4.32 KB

Marking the full string as safemarkup resolves the issue. Afaik only safe markup is passed there.

The last submitted patch, 5: views_filter_formatting-2432759-5.test-only.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 5: views_filter_formatting-2432759-5.patch, failed testing.

Anonymous’s picture

GET http://drupal.xio.local/admin/structure/views/nojs/rearrange-filter/test_filter_plugin_base/default returned 0 (0 bytes).

This passes on my local installation. I'm not sure why it doesn't on the testbot.

Anonymous’s picture

Ok, I'm an idiot. Let's retry this without an absolute path pointing to my local installation :)

Anonymous’s picture

Status: Needs work » Needs review

The last submitted patch, 9: views_filter_formatting-2432759-9.test-fail.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 9: views_filter_formatting-2432759-9.patch, failed testing.

Anonymous’s picture

Status: Needs work » Needs review
StatusFileSize
new3.29 KB
new4.29 KB

This is getting embarrassing.

The last submitted patch, 13: views_filter_formatting-2432759-13.test-fail.patch, failed testing.

koence’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new135.87 KB
new55.97 KB

Issue looks resolved.

Steps taken:
- Changed view Content (group filter changed from AND to OR) before latest patch (before_patch.png) to reproduce prescribed bug.
- Changed view Content (group filter changed from AND to OR) after latest patch (after_patch.png) gave no issue.

Added screenshots before and after patch.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/views_ui/src/ViewEditForm.php
@@ -1132,7 +1133,7 @@ public function getFormBucket(ViewUI $view, $type, $display) {
-            $store[$pid]['#link'] .= '  ' . ($group_info['groups'][$gid] == 'OR' ? $this->t('OR') : $this->t('AND'));
+            $store[$pid]['#link'] = SafeMarkup::set($store[$pid]['#link'] . '  ' . ($group_info['groups'][$gid] == 'OR' ? $this->t('OR') : $this->t('AND')));

Over in #2273923: Remove html => TRUE option from l() and link generator. we detail the correct way to fix this. I don't think we should we adding a call to SafeMarkup::set()

Anonymous’s picture

Status: Needs work » Needs review
StatusFileSize
new3.12 KB
new7.5 KB

Indeed it's probably better, so changed the patch as per #16.

The last submitted patch, 17: searches_for_words_with-731298-45.test-fail.patch, failed testing.

Anonymous’s picture

Wrong patches in #17. I feel embarrassed now.

Status: Needs review » Needs work

The last submitted patch, 19: views_filter_formatting-2432759-17.patch, failed testing.

The last submitted patch, 19: views_filter_formatting-2432759-17.test-fail.patch, failed testing.

Anonymous’s picture

This test fails due to a wrong encoding of the '>' character. IIRC there is an open issue that will fix this (it had an ampersand or a quote), but I don't seem to find it now.

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 19: views_filter_formatting-2432759-17.patch, failed testing.

Anonymous’s picture

Status: Needs work » Needs review
StatusFileSize
new4.19 KB
new745 bytes

resolved fatal error due to String:: class is removed in order to support php 7 https://api.drupal.org/api/drupal/core!lib!Drupal!Component!Utility!Stri...

Status: Needs review » Needs work

The last submitted patch, 25: views_filter_formatting-2432759-25.patch, failed testing.

Anonymous’s picture

lauriii’s picture

Status: Needs work » Closed (duplicate)

There is working patch on the other issue. Marking this as duplicate.