Steps to reproduce

- Create some kind of block without label, fx a content block.
- Create a panel
- Try to use the search
- Observe a javascript error breaks the search (TypeError: attribute is null)

Desired outcome

It's possible to search in the blocks that has a label

Proposed resolution

Fix the JavaScript error so search isn't broken if block models doesn't have the attribute defined that is being search for.

Issue fork panels-2938252

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

googletorp created an issue. See original summary.

googletorp’s picture

Status: Active » Needs review
StatusFileSize
new543 bytes

I have created a super simple patch, which changes null values into an empty string, ensuring the search works. The JavaScript looks to be built in a way, where it would be possible to search for any attribute defined in the JS model.

As search could be searching any attributes, making the default value "no label" seems like a poor option. Also this ensures search never breaks, as we know we that attributes is always a string. For me it also makes a lot of sense that you can't search for models missing the attribute being searched for.

MykolaVeryha’s picture

StatusFileSize
new539 bytes
MykolaVeryha’s picture

StatusFileSize
new539 bytes

Patch for 4.4

MykolaVeryha’s picture

dfdf

MykolaVeryha’s picture

StatusFileSize
new539 bytes

dfdf

MykolaVeryha’s picture

berliner’s picture

Status: Needs review » Reviewed & tested by the community

Patch in #2 applies properly and looks straight-forward enough to RTBC.

japerry’s picture

Status: Reviewed & tested by the community » Closed (outdated)
hchonov’s picture

Status: Closed (outdated) » Needs review
StatusFileSize
new563 bytes
liam morland’s picture

Status: Needs review » Needs work
Issue tags: +Needs merge request

joseph.olstad made their first commit to this issue’s fork.

joseph.olstad’s picture

Status: Needs work » Needs review
joseph.olstad’s picture

Issue tags: -Needs merge request

joelpittet made their first commit to this issue’s fork.

joelpittet’s picture

Status: Needs review » Fixed

Thank you all, this is straight forward and now an MR! Merged

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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