If we update to 8.x-1.9, we get an error message in Views whenever adding a contextual filter with validation criteria:

The submitted value in the Profile type element is not allowed.

A view can't be modifies or saved. Rolling back to 8.x-1.8 "solves" the issue.

CommentFileSizeAuthor
#5 3435967.patch608 bytesmkalkbrenner

Comments

mkalkbrenner created an issue. See original summary.

jsacksick’s picture

Priority: Critical » Major

Are you using the contextual filter introduced in the latest release? From issue #2835930: Provide Views argument for current user's profile ID?

Downgrading the priority to "major" as it doesn't render your site unusable afaik: https://www.drupal.org/docs/develop/issues/fields-and-other-parts-of-an-...

mkalkbrenner’s picture

Are you using the contextual filter introduced in the latest release? From issue #2835930: Provide Views argument for current user's profile ID?

No, it happens with the current store and our own contextual filters. So it seems that this new contextual filter modifies all the forms somehow.
And https://git.drupalcode.org/project/profile/-/commit/457170d860ab4aa6d3b3... seems related.

BTW for us it is critical as we need to adjust all our views with contextual filters and that can't be done by the site administrators.

jsacksick’s picture

hm... Extremely weird that the setting applies to all contextual filters... So you're saying just the "#required" attribute is causing this? WIthout the #required flag everything works ok?

mkalkbrenner’s picture

Status: Active » Needs review
StatusFileSize
new608 bytes

This patch solves the issue for us. It seems that you have to set the required flag only if this default argument is really selected. Or handle it in the form validation.

jsacksick’s picture

I didn't test that change I must admit, I was pinged by somebody from my team who reviewed the contextual filter and was surprised to see the setting not required as the contextual filter cannot work without the #required attribute.

poker10’s picture

@jsacksick I can confirm this issue as well (as I have also reported here #2835930: Provide Views argument for current user's profile ID). The #required attribute is the problem. The filter seems to be rendered even if not selected and thus the #required attribute prevents the possibility to save all contextual filters (therefore I think this is pretty major). Removing the #required attribute solved the problem for us.

I do not see any other class extending ArgumentDefaultPluginBase with #required attribute in buildOptionsForm(). If we want to require it, maybe we can use #states instead, or check it in the validation, as proposed in #5. Thanks for looking at this!

  • jsacksick committed 832344ae on 8.x-1.x
    Issue #3435967 by mkalkbrenner: Saving contextual filters broken in...
jsacksick’s picture

Status: Needs review » Fixed

Committed the change, thanks! Will tag a new release with the fix.

geek-merlin’s picture

FTR: If this causes regressions, i guess the #states voodoo needs to care for #required too.

Status: Fixed » Closed (fixed)

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

cayenne’s picture

I just updated to the latest version (10.2.5) and I am still experiencing this bug

Simple view of nodes, add a contextual filter by ID fails, with the dreaded "The submitted value in the Profile type element is not allowed." problem.

poker10’s picture

@Cayenne Have you updated the Profile module to 8.x-1.10 as well? This was a bug in the Profile module, not in Drupal core.