XF 2.2 <xf:textboxrow + Link

Robert9

Well-known member
Code:
<xf:textboxrow name="external_url" value="{$resource.external_url_}"
        maxlength="{{ max_length($resource, 'external_url') }}"
        label="{{ phrase('xfrm_additional_information_url') }}"
        explain="{{ phrase('r9_rmss_explain_external_url') }}" />

Can i add a link to this construct?
Or do we need a phrase and pass {$resource.external_url_} to it?
 
Did you ever figure this out? I'm also trying to add a link to the explain of a textboxrow.

I tried explainHtml="<a href='https://example.com'>example</a>"
And explain="{{ phrase('example_url') }}"
And explainHtml="{{ phrase('example_url') }}"

No luck.
 
explain="{{ phrase('yourphrase', {'url': 'https://example.com'}) }}" is the correct way to do it, assuming {url} is your variable within the phrase.

Example... I have an addon that allows users to create/change/view their API key:

1688230452859.png

The template portion is this:
HTML:
<xf:textboxrow rowtype="button" style="display:inline-block;width:40ch;" value="{$api_key.api_key}" label="{{ phrase('api_key') }}"
    explain="{{ phrase('api_key_explain', {'url': link('pages/api')}) }}"
    readonly="readonly">
    <xf:html><xf:button href="{{ link('account/api') }}" class="button--link" data-xf-click="overlay">{{ $api_key.api_key ? phrase('change') : phrase('create') }}</xf:button></xf:html>
</xf:textboxrow>

The api_key_explain phrase is this:
Code:
If you would like to make API calls, this is the API key you will need to do so (available to Enterprise customers).  <a href="{url}">API documentation</a>
 
explain="{{ phrase('yourphrase', {'url': 'https://example.com'}) }}" is the correct way to do it, assuming {url} is your variable within the phrase.

The phrase is opening an overlay. I also need to add data-overlay-config="{{ {'className':'your_class'}|json }} to the url.

I tried this as the phrase text: <a href="{url}" data-xf-click="overlay" data-overlay-config="{{ {'className':'your_class'}|json }}">What's This?</a>

But this had no effect.

Then I tried passing {{ {'className':'your_class'}|json }} as an additional variable for the phrase, but that did not seem to work either:
{{ phrase('yourphrase', {'url': link('resources/categories/myurl', $category), 'class': {{ {'className':'your_class'}|json }}}) }}
 
Back
Top Bottom