Views argument plugin needs to return ID, not store entity

Created on 26 August 2022, almost 2 years ago
Updated 8 May 2024, about 2 months ago

Problem/Motivation

You get an error when using the store contextual filter argerument using the default value "Store filter".

Error: Object of class Drupal\commerce_store\Entity\Store could not be converted to string in implode() (line 83 of core/modules/views/src/Plugin/views/argument/NumericArgument.php).

Steps to reproduce

  1. Add a view of type "Commerce Product"
  2. Add a contextual filter of "Product: Stores" and choose "Provide default value" and choose this module's argument, "Store filter"
  3. Load the view to get the error

Proposed resolution

Return the store ID, not the entity.

Remaining tasks

Update store filter default argument class to return the store ID.

I shall post a MR in a moment. Thanks for the excellent module by the way! :)

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom littlepixiez

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024