Problem/Motivation

Sometimes we could skip invoking the variant selection hook and render a selected variant directly if variant information is given (for example via the #variant SDC renderable array key).

Proposed resolution

Let's check if we can do it in ComponentVariantsHooks::preRenderComponent(https://git.drupalcode.org/project/component_variants/-/blob/1.0.x/src/H...) to convert to what Drupal\component_variants\TwigLoader\ComponentVariantLoader expects.

API changes

Ability to select variant on renderable creation stage.

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

graber created an issue. See original summary.

graber’s picture

Issue summary: View changes

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

s_leu’s picture

Status: Active » Needs review
graber’s picture

Status: Needs review » Fixed

Thought it'll be nice to add test coverage.

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.