mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-19797 Added callback support to the confirm_dialog function, and to the add_confirm_action() method
This commit is contained in:
parent
eef00ade8f
commit
5529f787bd
2 changed files with 23 additions and 8 deletions
|
@ -193,10 +193,12 @@ class moodle_html_component {
|
|||
* Shortcut for adding a JS confirm dialog when the component is clicked.
|
||||
* The message must be a yes/no question.
|
||||
* @param string $message The yes/no confirmation question. If "Yes" is clicked, the original action will occur.
|
||||
* @param string $callback The name of a JS function whose scope will be set to the simpleDialog object and have this
|
||||
* function's arguments set as this.args.
|
||||
* @return void
|
||||
*/
|
||||
public function add_confirm_action($message) {
|
||||
$this->add_action(new component_action('click', 'confirm_dialog', array('message' => $message)));
|
||||
public function add_confirm_action($message, $callback=null) {
|
||||
$this->add_action(new component_action('click', 'confirm_dialog', array('message' => $message, 'callback' => $callback)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue