Skip to content

Instantly share code, notes, and snippets.

@soifou
Created August 8, 2016 18:31
Show Gist options
  • Save soifou/eba4b6a632f57fc53c924686778ae6a7 to your computer and use it in GitHub Desktop.
Save soifou/eba4b6a632f57fc53c924686778ae6a7 to your computer and use it in GitHub Desktop.
Transform all Adminer selects into select2 (for filtering)
<?php
class AdminerSelect2
{
function head() {
?>
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js"></script>
<script>
jQuery(document).ready(function($) {
initSelect2();
jQuery('legend a').on('click', function(e) {
initSelect2();
});
});
function initSelect2() { jQuery('select').select2(); }
</script>
<?php
}
}
@soifou
Copy link
Author

soifou commented Feb 13, 2025

Wow did not remember of this gist :]

Actually this is a "plugin" for adminer that you need to setup like any other plugins, here the doc in case you missed it.

You can browse my custom adminer repository if you want a concrete example, and there is the call for this plugin.

Good luck!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment