bundles/FoxHabbit/BasisBundle/Resources/views/Areas/element/basisbundle-element-button/variant-button.html.twig line 1

Open in your IDE?
  1. {% import '@FoxHabbitBasis/Macro/wrap.html.twig' as wrap_macro %}
  2. {% if editmode or foxhabbit_common_tool_url_is_published( pimcore_relation('h')) or config.show_unpublished_as_disabled|default(false) %}
  3.     {% if editmode %}
  4.         {{ pimcore_input('t',{placeholder:'Linktext'}) }}
  5.         {{ pimcore_relation('h',{'reload': true}) }}
  6.         {{ pimcore_input('a',{placeholder:'#Anchor'}) }}
  7.         {% if pimcore_relation('h').getElement() and not foxhabbit_common_tool_url_is_published( pimcore_relation('h'))  %}
  8.             <div class="alert alert-danger">Link-Ziel nicht gepflegt oder nicht veröffentlicht.</div>
  9.         {% endif %}
  10.     {% endif %}
  11.     {% if editmode or foxhabbit_common_tool_url_is_published( pimcore_relation('h')) or config.show_unpublished_as_disabled|default(false) %}
  12.         {% set href = foxhabbit_common_tool_url_get_href( pimcore_relation('h')) %}
  13.         {% set target = foxhabbit_common_tool_url_get_target( pimcore_relation('h')) %}
  14.         {% set attr = config.attr|default({}) %}
  15.         {% if target and target != '_self' and not attr.target|default(null) %}
  16.             {% set attr = attr|merge({target:target}) %}
  17.         {% endif %}
  18.         {% set anchor = pimcore_input('a').getValue() %}
  19.         {% if anchor and anchor matches('@^[^#].*@') %}
  20.             {% set anchor = '#' ~ anchor %}
  21.         {% endif %}
  22.         {% if href or anchor %}
  23.             {% set wrapper = [ {tag: 'a', href: href~anchor, class: config.class|default('.btn'), attr: attr}, {tag: 'span', class: ''} ] %}
  24.         {% else %}
  25.             {% set wrapper = [ {tag: 'a', class: config.class|default('.btn'), attr: attr} ] %}
  26.         {% endif %}
  27.         {{ wrap_macro.wrapperOpen( wrapper, _context) -}}
  28.             {{- pimcore_input('t').getValue() -}}
  29.         {{- wrap_macro.wrapperClose( wrapper, _context) }}
  30.     {% endif %}
  31. {% endif %}