wearewondrous / icon_select_field

Drupal 8 module. Use jQuery plugin Select2 dropdown to select an icon from a given list.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

Drupal 8 module. Use jQuery plugin Select2 dropdown to select an icon from a given list.

License:GNU General Public License v3.0


Languages

Language:PHP 88.2%Language:Twig 5.3%Language:CSS 3.9%Language:JavaScript 2.6%