From 33636dc66d0e52d01add2ad68397e6ed20a796a9 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Mon, 8 Jan 2024 17:01:18 +0000 Subject: [PATCH] MDL-72376 mod_book: final removal of deprecated navigation method. --- mod/book/deprecatedlib.php | 38 +++++++++++++++++++++++++++++++++ mod/book/lang/en/book.php | 8 ++++--- mod/book/lang/en/deprecated.txt | 3 +++ mod/book/lib.php | 27 ++--------------------- mod/book/locallib.php | 10 --------- mod/book/upgrade.txt | 4 ++++ 6 files changed, 52 insertions(+), 38 deletions(-) create mode 100644 mod/book/deprecatedlib.php create mode 100644 mod/book/lang/en/deprecated.txt diff --git a/mod/book/deprecatedlib.php b/mod/book/deprecatedlib.php new file mode 100644 index 00000000000..8c2c23ec10e --- /dev/null +++ b/mod/book/deprecatedlib.php @@ -0,0 +1,38 @@ +. + +/** + * List of deprecated mod_book functions + * + * @package mod_book + * @copyright 2024 Paul Holden + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +/** + * @deprecated since Moodle 3.8 + */ +function book_scale_used() { + throw new coding_exception('book_scale_used() can not be used anymore. Plugins can implement ' . + '_scale_used_anywhere, all implementations of _scale_used are now ignored'); +} + +/** + * @deprecated since Moodle 4.0 + */ +function book_get_nav_types() { + throw new coding_exception(__FUNCTION__ . '() has been removed.'); +} diff --git a/mod/book/lang/en/book.php b/mod/book/lang/en/book.php index 7f2e9055d04..a9aeda657b7 100644 --- a/mod/book/lang/en/book.php +++ b/mod/book/lang/en/book.php @@ -72,14 +72,11 @@ $string['search:activity'] = 'Book - resource information'; $string['search:chapter'] = 'Book - chapters'; $string['showchapter'] = 'Show chapter "{$a}"'; $string['subchapter'] = 'Subchapter'; -$string['navimages'] = 'Images'; $string['navoptions'] = 'Available options for navigational links'; $string['navoptions_desc'] = 'Options for displaying navigation on the book pages'; $string['navstyle'] = 'Style of navigation'; $string['navstyle_help'] = '* Images - Icons are used for navigation * Text - Chapter titles are used for navigation'; -$string['navtext'] = 'Text'; -$string['navtoc'] = 'TOC Only'; $string['nocontent'] = 'No content has been added to this book yet.'; $string['numbering'] = 'Chapter formatting'; $string['numbering_help'] = '* None - Chapter and subchapter titles have no formatting @@ -117,3 +114,8 @@ $string['subplugintype_booktool_plural'] = 'Book tools'; $string['removeallbooktags'] = 'Remove all book tags'; $string['tagarea_book_chapters'] = 'Book chapters'; $string['tagsdeleted'] = 'Book tags have been deleted'; + +// Deprecated since Moodle 4.4. +$string['navimages'] = 'Images'; +$string['navtext'] = 'Text'; +$string['navtoc'] = 'TOC Only'; diff --git a/mod/book/lang/en/deprecated.txt b/mod/book/lang/en/deprecated.txt new file mode 100644 index 00000000000..432f97ebbf0 --- /dev/null +++ b/mod/book/lang/en/deprecated.txt @@ -0,0 +1,3 @@ +navimages,mod_book +navtext,mod_book +navtoc,mod_book diff --git a/mod/book/lib.php b/mod/book/lib.php index d5a0d964862..4ad547c73a3 100644 --- a/mod/book/lib.php +++ b/mod/book/lib.php @@ -24,6 +24,8 @@ defined('MOODLE_INTERNAL') || die; +require_once(__DIR__ . '/deprecatedlib.php'); + /** * Returns list of available numbering types * @return array @@ -41,23 +43,6 @@ function book_get_numbering_types() { ); } -/** - * Returns list of available navigation link types. - * - * @deprecated since Moodle 4.0. MDL-72376. - * @return array - */ -function book_get_nav_types() { - debugging("book_get_nav_types() is deprecated. There is no replacement. Navigation is now only next and previous."); - require_once(__DIR__.'/locallib.php'); - - return array ( - BOOK_LINK_TOCONLY => get_string('navtoc', 'mod_book'), - BOOK_LINK_IMAGE => get_string('navimages', 'mod_book'), - BOOK_LINK_TEXT => get_string('navtext', 'mod_book'), - ); -} - /** * Returns list of available navigation link CSS classes. * @return array @@ -217,14 +202,6 @@ function book_grades($bookid) { return null; } -/** - * @deprecated since Moodle 3.8 - */ -function book_scale_used() { - throw new coding_exception('book_scale_used() can not be used anymore. Plugins can implement ' . - '_scale_used_anywhere, all implementations of _scale_used are now ignored'); -} - /** * Checks if scale is being used by any instance of book * diff --git a/mod/book/locallib.php b/mod/book/locallib.php index 84636d8311c..7cf022b4030 100644 --- a/mod/book/locallib.php +++ b/mod/book/locallib.php @@ -39,16 +39,6 @@ define('BOOK_NUM_NUMBERS', '1'); define('BOOK_NUM_BULLETS', '2'); define('BOOK_NUM_INDENTED', '3'); -/** - * The following defines are used to define the navigation style used within a book. - * BOOK_LINK_TOCONLY Only the table of contents is shown, in a side region. - * BOOK_LINK_IMAGE Arrows link to previous/next/exit pages, in addition to the TOC. - * BOOK_LINK_TEXT Page names and arrows link to previous/next/exit pages, in addition to the TOC. - */ -define ('BOOK_LINK_TOCONLY', '0'); -define ('BOOK_LINK_IMAGE', '1'); -define ('BOOK_LINK_TEXT', '2'); - /** * Preload book chapters and fix toc structure if necessary. * diff --git a/mod/book/upgrade.txt b/mod/book/upgrade.txt index e3a7853754e..dce1213b606 100644 --- a/mod/book/upgrade.txt +++ b/mod/book/upgrade.txt @@ -1,5 +1,9 @@ This files describes API changes in the book code. +=== 4.4 === + +* The previously deprecated `book_get_nav_types` method has been removed, along with the `BOOK_LINK_*` constants + === 4.0 === * book_get_nav_types() has been deprecated. Related settings have been removed. The navigation is now set to only "next" and