wpbp / backbone-modal-view
在WordPress中添加一个按钮并使用Backbone Modal View列表
1.0.2
2017-03-31 16:53 UTC
This package is auto-updated.
Last update: 2024-09-20 03:33:24 UTC
README
在按钮上添加一个Backbone Modal View列表
是什么?
您想要一个包含搜索的模态框,而不需要开发JavaScript吗?
此代码非常简单,它生成一个您可以打印或返回到您希望的位置的按钮,该按钮将打开模态视图。
您只需要定义列表的输出(HTML)和保存已选中元素的AJAX调用。
查看代码示例并尝试它,以了解如何节省您宝贵的时间!
示例代码在类中将选中的元素作为以逗号和空格分隔的字符串保存到用户字段中。
示例
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? ));