Problem/Motivation

The CTA component calls the wrong prop names for cta.twig on prototype:link with link_link and link_icon, while the link.twig contains link and icon. The with_content = false is only passing the variables inside of the component leaving the href empty for the text on the display.

Steps to reproduce

  1. Add a CTA paragraph with a title, text, and link.
  2. View the page.
  3. The link element renders in the HTML but href is empty and the link text is missing.

Proposed resolution

In cta.twig, change the prototype:link include from:

<?php
<code>{{ include('prototype:link', {
  classes: ['c-cta__link'],
  link_link: { url: link.url, title: link.title },
  link_icon: icon,
  attr: create_attribute(),
}, with_context = false) }}

?>

{{ include('prototype:link', {
  classes: ['c-cta__link'],
  link: { url: link.url, title: link.title },
  icon: icon,
  attr: create_attribute(),
}, with_context = false) }}

Issue fork prototype-3586768

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

grgcrlsn321 created an issue. See original summary.

grgcrlsn321’s picture

Status: Active » Needs work

Corrected the prop names to work for CTA link. Needs review.

grgcrlsn321’s picture

Status: Needs work » Needs review

  • 710c6be3 committed on 5.x
    Issue #3586768: correct cta.twig prop names
    
jldust’s picture

Status: Needs review » Fixed

This has been merged in and will be included in the next tagged release.

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.