ui/twig/common/buttons/default.html.twig line 1

Open in your IDE?
  1. {#
  2.     Basic button style.
  3.     While technically both icon and text are optional, one of them should be given.
  4.     Otherwise, button renders out as a blank thing.
  5.     @opt    bool    block       Whether or not to render button with Bootstrap "block" style
  6.     @opt    bool    blockxs     Whether or not to render button with Bootstrap "blockxs" style
  7.     @opt    string  form        Form button type, if needed (like "submit")
  8.     @opt    string  helper      Bootstrap-based class for coloring the button
  9.     @opt    string  htmlClass   Extra CSS classes to append to button class attribute
  10.     @opt    string  htmlId      Value to use for element's ID attribute; if NULL attribute is not rendered
  11.     @opt    string  htmlTag     The HTML tag name to use for the element.
  12.     @opt    string  icon        The FontAwesome icon name to use, if NULL icon chunk is not rendered
  13.     @opt    string  link        Used as the HREF attribute on the link
  14.     @opt    string  isLink      Choose link or not
  15.     @opt    string  size        The Bootstrap-based button sizing name
  16.     @opt    string  text        Primary text to use for the link, if NULL text chunk is not rendered
  17. #}
  18. {% set block        = _args.block|default(false) %}
  19. {% set blockxs      = _args.blockxs|default(false) %}
  20. {% set blocksm      = _args.blocksm|default(false) %}
  21. {% set stroke      = _args.stroke|default(false) %}
  22. {% set form         = _args.form|default(null) %}
  23. {% set helper       = _args.helper|default('default') %}
  24. {% set htmlClass    = _args.htmlClass|default(null) %}
  25. {% set htmlId       = _args.htmlId|default(null) %}
  26. {% set htmlTag      = _args.htmlTag|default('a') %}
  27. {% set icon         = _args.icon|default(null) %}
  28. {% set iconCustom   = _args.iconCustom|default(null) %}
  29. {% set link         = _args.link|default('#') %}
  30. {% set isLink       = _args.isLink is defined ? _args.isLink : true %}
  31. {% set sronly       = _args.sronly is defined ? _args.sronly : false %}
  32. {% set modal        = _args.modal|default(null) %}
  33. {% set size         = _args.size|default(null) %}
  34. {% set text         = _args.text|default(null) %}
  35. {% set dataAttrs    = _args.dataAttrs|default(null) %}
  36. {% set formaction   = _args.formaction|default(null) %}
  37. {% set helpText     = _args.helpText|default(null) %}
  38. <{{ htmlTag }}{% if form is not null %} type="{{ form }}"{% endif %}{% if htmlId is not null %} id="{{ htmlId }}"{% endif %} class="btn btn-{{ helper }}{% if size is not null %} btn-{{ size }}{% endif %}{% if block %} btn-block{% endif %}{% if blockxs %} btn-block-xs{% endif %}{% if blocksm %} btn-block-sm{% endif %}{% if stroke %} btn-stroke{% endif %}{% if htmlClass is not null %} {{ htmlClass }}{% endif %}" {% if isLink %}href="{{ link }}"{% endif %}{% if modal is not null %} data-toggle="modal" data-target="{{ modal }}"{% endif %}{% if dataAttrs is not empty %} {{ dataAttrs|raw }}{% endif %}{% if formaction is not empty %} formaction="{{ formaction|escape('html_attr') }}"{% endif %} {% if helpText is not null %}data-placement='right' data-trigger='hover' data-toggle='tooltip' data-original-title="{{ helpText }}"{% endif %}>
  39.     {% if icon is not empty %}
  40.         <i class="fa fa-{{ icon }}"></i>
  41.     {% endif %}
  42.     {% if iconCustom is not empty %}
  43.         <i class="csi {{ iconCustom }}"></i>
  44.     {% endif %}
  45.     {% if text is not empty %}
  46.         {% if sronly is not same as(true) %}
  47.             <span>{{ text|trans }}</span>
  48.         {% else %}
  49.             <span class="sr-only">{{ text|trans }}</span>
  50.         {% endif %}
  51.     {% endif %}
  52. </{{ htmlTag }}>