mustardBees / cmb-field-select2

Select2 field type for Custom Metaboxes and Fields for WordPress
93 stars 46 forks source link

Attribute not working data-minimum-results-for-search #56

Open jerasokcm opened 6 days ago

jerasokcm commented 6 days ago

This custom field works fine. However, I can't hide the search box when dealing with a small number of options. Something like this is not working:

$cmb->add_field( array(
    'name'    => 'Ingredients',
    'id'      => $prefix . 'ingredients',
    'desc'    => 'Select this recipes ingredients.',
    'type'    => 'pw_select',
    'options' => array(
        'flour'  => 'Flour',
        'salt'   => 'Salt',
        'eggs'   => 'Eggs',
        'milk'   => 'Milk',
        'butter' => 'Butter',
    ),
    'attributes' => array(
        'placeholder' => 'Select ingredient',
                'data-minimum-results-for-search' => '20',       
    ),
) );

Thanks in advance for your suggestions.