Skip to content

Uses Selectize on all InputfieldSelect fields in the ProcessWire admin.

License

Notifications You must be signed in to change notification settings

Toutouwai/SelectizeAll

Repository files navigation

Selectize All

Enables Selectize on all InputfieldSelect and InputfieldAsmSelect fields in the ProcessWire admin.

The module activates Selectize on the <select> element when it is focused, and destroys Selectize when the element is blurred. This allows Selectize to work on selects where the options are changed dynamically after page load depending on other field values, e.g. the "Select File" field in the CKEditor link modal or a dependent select in Page Edit.

Only AdminThemeUikit is tested and supported.

selectize-select

selectize-asm

Usage

In the module config you can choose if Selectize should be used with InputfieldSelect, InputfieldAsmSelect, or both.

If you want to disable the module for a specific Select or AsmSelect inputfield you can hook SelectizeAll::allowSelectize. This method receives the Inputfield object as the first argument.

Example:

$wire->addHookAfter('SelectizeAll::allowSelectize', function(HookEvent $event) {
    $inputfield = $event->arguments(0);
    // You can also get any associated Page and Field objects via $inputfield->hasPage and $inputfield->hasField

    // Disable the module for the inputfield named "template"
    if($inputfield->name === 'template') $event->return = false;
});

If you are creating an inputfield via the API (e.g. in a custom module) you can also disable SelectizeAll for the inputfield by giving it a "no-selectize" class, e.g.

$inputfield->addClass('no-selectize');

About

Uses Selectize on all InputfieldSelect fields in the ProcessWire admin.

Resources

License

Stars

Watchers

Forks

Packages

No packages published