iconpicker.html.twig 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. {% extends "forms/field.html.twig" %}
  2. {% set originalValue = originalValue is defined ? originalValue : value %}
  3. {% set value = (value is null ? field.default : value) %}
  4. {% block global_attributes %}
  5. data-grav-iconpicker
  6. data-name="{{field.name}}"
  7. data-value="{{value}}"
  8. {{ parent() }}
  9. {% endblock %}
  10. {% block input %}
  11. <div class="form-list-wrapper {{ field.size }}" data-type="collection">
  12. <div class="icon-picker" data-pickerid="fa" data-iconsets='{"fa":"FontAwesome Icons"}'>
  13. <input
  14. {# required attribute structures #}
  15. name="{{ (scope ~ field.name)|fieldName }}"
  16. data-format="{{ field.format == 'short' ? 'short' : 'long' }}"
  17. value="{{ value|raw|join(', ') }}"
  18. type="text"
  19. {# input attribute structures #}
  20. {% block input_attributes %}
  21. {% if field.classes is defined %}class="{{ field.classes }}" {% endif %}
  22. {% if field.id is defined %}id="{{ field.id|e }}" {% endif %}
  23. {% if field.style is defined %}style="{{ field.style|e }}" {% endif %}
  24. {% if field.disabled %}disabled="disabled"{% endif %}
  25. {% if field.placeholder %}placeholder="{{ field.placeholder }}"{% endif %}
  26. {% if field.autofocus in ['on', 'true', 1] %}autofocus="autofocus"{% endif %}
  27. {% if field.novalidate in ['on', 'true', 1] %}novalidate="novalidate"{% endif %}
  28. {% if field.readonly in ['on', 'true', 1] %}readonly="readonly"{% endif %}
  29. {% if field.autocomplete in ['on', 'off'] %}autocomplete="{{ field.autocomplete }}"{% endif %}
  30. {% if field.validate.required in ['on', 'true', 1] %}required="required"{% endif %}
  31. {% endblock %}
  32. />
  33. </div>
  34. <div class="fa-set icon-set">
  35. <ul>
  36. {% for icon in fa_icons %}
  37. <li data-code="{{icon.unicode}}" data-class="fa fa-{{icon.id}}" class="fa fa-{{icon.id}}"></li>
  38. {% endfor %}
  39. </ul>
  40. </div>
  41. </div>
  42. {% endblock %}