Problem/Motivation

Tokens are not replaced in the url setting of the button pattern.

In app/modules/contrib/ui_patterns_settings/src/Element/PatternSettings.php::processSettings():

$entity = $context->getProperty('entity');

But in app/modules/contrib/ui_patterns_entity_links/src/Plugin/Block/LinkBlock.php:

    $build['#context'] = [
      'type' => 'entity_link',
      'entity_type' => $this->getEntity()->getEntityTypeId(),
      'entity_id' => $this->getEntity()->id(),
      'link' => $rel,
    ];

The entity is not passed into the build context.

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

Grimreaper created an issue. See original summary.

grimreaper’s picture

grimreaper’s picture

Project: UI Suite Bootstrap » UI Patterns 1.x Entity Links
Version: 5.0.x-dev » 8.x-1.x-dev
Issue summary: View changes
grimreaper’s picture

Title: Patterns: url setting in button pattern does not work with tokens » Pass the entity into the build context
Category: Bug report » Feature request

grimreaper’s picture

Assigned: grimreaper » Unassigned
Issue summary: View changes
Status: Active » Needs review
pdureau’s picture

Good catch! We need to standardize those #context keys ans strategies among all the UI Patterns ecosystem.

pdureau’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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