function fontawesome_iconpicker_icon_field_icon_value_callback in Font Awesome Iconpicker 7
Helper function to remove the fontawesome prefix for icon api fields.
1 string reference to 'fontawesome_iconpicker_icon_field_icon_value_callback'
File
- ./
fontawesome_iconpicker.module, line 138 - Integrates fontawesome-iconpicker plugin with Drupal.
Code
function fontawesome_iconpicker_icon_field_icon_value_callback($element, $input = FALSE, $form_state = array()) {
if ($input !== FALSE) {
$prefix = FONTAWESOME_ICONPICKER_ICON_PREFIX;
$str = trim($input);
if (substr($str, 0, strlen($prefix)) == $prefix) {
$str = substr($str, strlen($prefix));
return $str;
}
}
else {
return isset($element['#default_value']) ? $element['#default_value'] : NULL;
}
return $input;
}