Icon Popup
The icon-popup
is an efficient field to use icon from various types.
Field Parameters
Name | Type | Default | Description |
---|---|---|---|
type | string | ‘icon-popup’ | Value identifies the field types. |
id | string | Identifies unique ID for the field. It must be different from other existing field IDs. | |
title | string | Displays the field label. | |
desc | string | Describe the field option in details, appears underneath the field control. | |
required | array | Acts like boolean operator and provides the parent, comparison operation, and value which decides the field visibility. | |
value | string | Display default string in the text input. | |
buttons | array | Popup Buttons | |
providers | array | upb_icon_providers() |
Icon Providers |
Example Declaration
array(
'id' => 'icon',
'title' => esc_html__( 'Label', 'ultimate-page-builder' ),
'desc' => wp_kses_post( __( 'Description', 'ultimate-page-builder' )),
'type' => 'icon-popup',
'value' => '',
'providers' => upb_icon_providers()
);
upb_icon_providers()
haveupb_icon_providers
filter to modify icon providers lists globally.
How to add extra icons?
- Add Icon fonts CSS on
upb_boilerplate_print_styles
andwp_enqueue_scripts
- Add a provider first.
- Use
upb_icon_popup_icons
filter to add your specific provider icons. This filter have 2 argument. 1st one is icons 2nd one is provider.
Example:
add_filter( 'upb_icon_popup_icons', function ( $icons, $provider ) {
switch ( $provider ) {
case 'materialdesign':
$icons = upb_material_design_icons();
break;
case 'fontawesome':
$icons = upb_font_awesome_icons();
break;
case 'dashicons':
$icons = upb_dash_icon_icons();
break;
}
return $icons;
}, 10, 2 );