Upcast named arguments/named parameters in views

Created on 7 July 2015, over 9 years ago
Updated 14 January 2024, 11 months ago

Problem/Motivation

Upcasting of route named Views parameters does not work. For instance, I'm expecting that a %user Views argument, which is set to validate as a valid user entity, will be upcasted to a user entity object. Running the following code should pass:

$account = \Drupal::routeMatch()->getParameter('user');
assert($account instanceof \Drupal\user\UserInterface);

Instead, the route matcher is still returning the raw argument as user ID.

Proposed resolution

Allow named parameters upcating to entities. Use the argument validation plugin to determine if a named parameter can be upcasted to its entity object.

Remaining tasks

None.

User interface changes

None.

API changes

Named Views arguments, validating as entities, are now upcasted as entity objects.

Data model changes

None.

Release notes snippet

If a named Views argument is validated as an entity then it will upcast as entity object.

✨ Feature request
Status

Needs work

Version

11.0 πŸ”₯

Component
ViewsΒ  β†’

Last updated about 7 hours ago

Created by

πŸ‡©πŸ‡ͺGermany webflo

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

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.71.5 2024