wpbp/backbone-modal-view

Add on a button a Backbone Modal View with a list for WordPress

1.0.2 2017-03-31 16:53 UTC

This package is auto-updated.

Last update: 2024-04-20 02:39:50 UTC


README

License Downloads

Add on a button a Backbone Modal View with a list

What?

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.

Example

Screenshot

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?
		));