diff --git a/mod/book/locallib.php b/mod/book/locallib.php index 0cfe1921b7e..556b2c873de 100644 --- a/mod/book/locallib.php +++ b/mod/book/locallib.php @@ -299,9 +299,20 @@ function book_get_toc($chapters, $chapter, $book, $cm, $edit) { $toc .= html_writer::link(new moodle_url('edit.php', array('cmid' => $cm->id, 'id' => $ch->id)), $OUTPUT->pix_icon('t/edit', get_string('editchapter', 'mod_book', $title)), array('title' => get_string('editchapter', 'mod_book', $titleunescaped))); - $toc .= html_writer::link(new moodle_url('delete.php', array('id' => $cm->id, 'chapterid' => $ch->id, 'sesskey' => $USER->sesskey)), - $OUTPUT->pix_icon('t/delete', get_string('deletechapter', 'mod_book', $title)), - array('title' => get_string('deletechapter', 'mod_book', $titleunescaped))); + + $deleteaction = new confirm_action(get_string('deletechapter', 'mod_book', $titleunescaped)); + $toc .= $OUTPUT->action_icon( + new moodle_url('delete.php', [ + 'id' => $cm->id, + 'chapterid' => $ch->id, + 'sesskey' => sesskey(), + 'confirm' => 1, + ]), + new pix_icon('t/delete', get_string('deletechapter', 'mod_book', $title)), + $deleteaction, + ['title' => get_string('deletechapter', 'mod_book', $titleunescaped)] + ); + if ($ch->hidden) { $toc .= html_writer::link(new moodle_url('show.php', array('id' => $cm->id, 'chapterid' => $ch->id, 'sesskey' => $USER->sesskey)), $OUTPUT->pix_icon('t/show', get_string('showchapter', 'mod_book', $title)),