Skip to content

Call out box link prints when the link field is empty. #866

@msayoung

Description

@msayoung

The link is printing whether or not there is another in the link field.

In paragraph--localgov-call-out-box.html.twig the localgov_button needs an if statement.

The link field is not required.

  <div class="call-out-box__content">

    {% if heading['#context']['text'] %}
      {{ heading }}
    {% endif %}

    {{ content|without('localgov_button', 'localgov_background_image', 'localgov_colour_theme', 'localgov_header_text', 'localgov_heading_level', 'localgov_opens_in_a_new_window') }}
    <a href="{{ button_url }}" class="call-out-box__link"
      {% if open_in_new_window %} target="_blank" {% endif %}>
      <span>{{ paragraph.localgov_button.getValue[0].title }}</span>
      {% if open_in_new_window %}
        <span class="visually-hidden"> {{ '(opens in a new window)'|t }}</span>
      {% endif %}
    </a>
  </div>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions