Add on a button a Backbone Modal View with a list
Do you want a modal with search included withoout develop in Javascript?
This code is very simple, is generated a button that you can print or return where you prefer that will open a modal view.
You have only to define the output of the list (HTML) and the AJAX call where save the element checked.
Check the code example and try it to understand how can save so much your precious time!
The example code in the class, save the checked element as a string separated by ', ' in an user field.
new BB_Modal_View( array(
'id' => 'test', // ID of the modal view
'hook' => 'admin_notices', // Where return or print the button
'input' => 'checkbox', // Or radio
'label' => __( 'Open Modal' ), // Button text
'data' => array( 'rand' => rand() ), // Array of custom datas
'ajax' => array( $this, 'ajax_posts' ), // Ajax function for the list to show on the modal
'ajax_on_select' => array( $this, 'ajax_posts_selected' ), // Ajax function to execute on Select button
'echo_button' => true // Do you want echo the button in the hook chosen or only return?
));