Skip to content

Commit

Permalink
MDL-74939 output: final removal of deprecated navigation namespace.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulholden committed Aug 15, 2024
1 parent a75365f commit 5b4e858
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 51 deletions.
8 changes: 8 additions & 0 deletions .upgradenotes/MDL-74939-2024053010552599.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
issueNumber: MDL-74939
notes:
core:
- message: >-
Support for deprecated `<component>\local\views\secondary`
block/activity namespace, for overriding secondary navigation, is now
entirely removed
type: removed
11 changes: 3 additions & 8 deletions lib/blocklib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1726,22 +1726,17 @@ public function process_url_show_hide() {
* Convenience function to check whether a block is implementing a secondary nav class and return it
* initialised to the calling function
*
* @todo MDL-74939 Remove support for old 'local\views\secondary' class location
* @param block_base $block
* @return \core\navigation\views\secondary
*/
protected function get_secondarynav(block_base $block): \core\navigation\views\secondary {
$class = "core_block\\navigation\\views\\secondary";

// Check whether block defines its own secondary navigation.
if (class_exists("block_{$block->name()}\\navigation\\views\\secondary")) {
$class = "block_{$block->name()}\\navigation\\views\\secondary";
} else if (class_exists("block_{$block->name()}\\local\\views\\secondary")) {
// For backwards compatibility, support the old location for this class (it was in a
// 'local' namespace which shouldn't be used for core APIs).
debugging("The class block_{$block->name()}\\local\\views\\secondary uses a deprecated " .
"namespace. Please move it to block_{$block->name()}\\navigation\\views\\secondary.",
DEBUG_DEVELOPER);
$class = "block_{$block->name()}\\local\\views\\secondary";
}

$secondarynav = new $class($this->page);
$secondarynav->initialise();
return $secondarynav;
Expand Down
1 change: 0 additions & 1 deletion lib/db/renamedclasses.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
'core_course\\local\\entities\\course_category' => 'core_course\\reportbuilder\\local\\entities\\course_category',
'core_cohort\\local\\entities\\cohort' => 'core_cohort\\reportbuilder\\local\\entities\\cohort',
'core_cohort\\local\\entities\\cohort_member' => 'core_cohort\\reportbuilder\\local\\entities\\cohort_member',
'core_block\\local\\views\\secondary' => 'core_block\\navigation\\views\\secondary',
// Since Moodle 4.2.
'Box\\Spout' => 'OpenSpout',
// Since Moodle 4.3.
Expand Down
11 changes: 2 additions & 9 deletions lib/pagelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -879,22 +879,15 @@ protected function magic_get_activityheader(): activity_header {
/**
* Returns the secondary navigation object
*
* @todo MDL-74939 Remove support for old 'local\views\secondary' class location
* @return secondary
*/
protected function magic_get_secondarynav() {
if ($this->_secondarynav === null) {
$class = 'core\navigation\views\secondary';
// Try and load a custom class first.

// Check whether activity defines its own secondary navigation.
if (class_exists("mod_{$this->activityname}\\navigation\\views\\secondary")) {
$class = "mod_{$this->activityname}\\navigation\\views\\secondary";
} else if (class_exists("mod_{$this->activityname}\\local\\views\\secondary")) {
// For backwards compatibility, support the old location for this class (it was in a
// 'local' namespace which shouldn't be used for core APIs).
debugging("The class mod_{$this->activityname}}\\local\\views\\secondary uses a deprecated " .
"namespace. Please move it to mod_{$this->activityname}\\navigation\\views\\secondary.",
DEBUG_DEVELOPER);
$class = "mod_{$this->activityname}\\local\\views\\secondary";
}

$this->_secondarynav = new $class($this);
Expand Down
31 changes: 0 additions & 31 deletions mod/assign/db/renamedclasses.php

This file was deleted.

2 changes: 0 additions & 2 deletions mod/quiz/db/renamedclasses.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
defined('MOODLE_INTERNAL') || die();

$renamedclasses = [
// Since Moodle 4.1.
'mod_quiz\local\views\secondary' => 'mod_quiz\navigation\views\secondary',
// Since Moodle 4.2.
'mod_quiz_display_options' => 'mod_quiz\question\display_options',
'qubaids_for_quiz' => 'mod_quiz\question\qubaids_for_quiz',
Expand Down

0 comments on commit 5b4e858

Please sign in to comment.