icon_select_field
Drupal 8 module. Special Dropdown to indicate color of a stripe. It's also compatible with Drupal 9.
Usage
After install you will find a new field Type. Use as desired.
Go to the settings page /admin/config/content/icon_select_field
and add the needed colors.
We normally add the new field named Icon Select
.
Then in the field--field-icon-select.html.twig
we put the following:
<i class="{{ element['#items'].getString }}"></i>
Since you can include SVG files directly in D8 twig, an other way would be like this:
{% include directory ~ '/icons/' ~ content.field_icon_select['#items'].getstring|replace({'icon-': ''})|trim ~ '.svg' %}
Demo Screen
When placed into a field, it looks like this:
Backend settings page
Credits
code base: github.com/wearewondrous/icon_select_field
developed by WONDROUS LLC