Ajax Icon Select

  • It allows select icons from ajax retrieved icon list.
Name Type Default Description
type string ‘ajax-icon-select’ 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.
placeholder string Default message to display when no input is inserted.
hooks array Display ajax retrieved data
settings array Add some settings

Example Code:

array(
    'id'    => 'icon',
    'title' => esc_html__( 'Label', 'ultimate-page-builder' ),
    'desc'  => wp_kses_post( __( 'Description', 'ultimate-page-builder' )),
    'type'  => 'ajax-icon-select',
    'value' => '',
    'hooks'=>array(  
        'search'=>'_upb_material_icon_search', // wp_ajax__upb_material_icon_search
        'load'=>'_upb_material_icon_load' // wp_ajax__upb_material_icon_load
     ),
    'settings'=>array(
        'allowClear'=>true,
        ),

    'ajaxOptions'=>array(
        'type'  => 'GET', // POST
        'cache'=>true
        )
    );

Hook

Hooks is used to fetch icon data or load icon data through Ajax call. It's an associative array which have search and load key. search key is for searching data and load to populate selected data.

  • search - If no search hook provided default search hook will be: _upb_element_[tag]_[id]_search.
  • load - If no load hook provided default load hook will be: _upb_element_[tag]_[id]_load.

Use

  • To use Dashicons Icon. You can use: upb_dashicons_icon_search value as search hook key and upb_dashicons_icon_load value for load hook key.

  • To use Material Design Icon (1.8.36). You can use: upb_material_icon_search value as search hook key and upb_material_icon_load value for load hook key.

  • To use Font Awesome Icon (4.7). You can use: _upb_font_awesome_icon_search value as search hook key and _upb_font_awesome_icon_load value for load hook key.

  • settings - you can set select2 settings from this key.

    • allowClear - Show × Cross button to clear field. Default is true.
  • ajaxOptions - you can change ajax data sending method and enable or disable ajax data caching.

    • type - Sending type. Default method type is GET.
    • cache - Data caching. Default is true.

There is also 3 icon input function available to generated ajax icon input field.

  • upb_material_icon_input()
  • upb_font_awesome_icon_input()
  • upb_dashicons_icon_input()

results matching ""

    No results matching ""