presseddigital / linkit

Linkit Plugin for Craft 4
Other
28 stars 18 forks source link

Target is outputting "1" instead of "_blank" #71

Closed darylknight closed 2 years ago

darylknight commented 5 years ago

I just noticed on a site I'm working on, that if a LinkIt field has "Open link in new tab" checked, it's outputting "1" instead of "_blank" in the code. Still seems to work, but it's not valid:

{% if block.button|length %}<a href="{{ block.button.url }}" class="btn btn-red mt-2" target="{{ block.button.target }}">{{ block.button.text }}</a>{% endif %}

image

image

simonkuran commented 4 years ago

I'm guessing this is intended. I write my conditionals like a boolean check {% if block.button.target %} target="_blank"{% endif %}.

jamesmacwhite commented 4 years ago

@darylknight @simonkuran In Craft 3 Linkit now has a .targetString property, which gives you the actual value for the target attribute, so it's a bit cleaner.

samhibberd commented 2 years ago

@jamesmacwhite is right on this, the target string property covers off this.