MDL-74733 core_navigation: Secondary nav in plugins, change namespace
Secondary nav previously had to be in my_plugin\local\views\secondary; this location continues to work but is deprecated. The new location is my_plugin\navigation\views\secondary.
This commit is contained in:
+1
-1
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace core_block\local\views;
|
||||
namespace core_block\navigation\views;
|
||||
|
||||
/**
|
||||
* Class secondary
|
||||
+10
-2
@@ -1684,12 +1684,20 @@ class block_manager {
|
||||
* 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\\local\\views\\secondary";
|
||||
if (class_exists("block_{$block->name()}\\local\\views\\secondary")) {
|
||||
$class = "core_block\\navigation\\views\\secondary";
|
||||
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);
|
||||
|
||||
+10
-1
@@ -867,13 +867,22 @@ class moodle_page {
|
||||
|
||||
/**
|
||||
* 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.
|
||||
if (class_exists("mod_{$this->activityname}\\local\\views\\secondary")) {
|
||||
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";
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,9 @@ information provided here is intended especially for developers.
|
||||
* For performance reasons, sql_reader interface has a new function get_events_select_exists() which determines whether
|
||||
an event exists with the given criteria (see MDL-72723 for details).
|
||||
- Breaking: 3rd party log readers implementing interface sql_reader will need to implement get_events_select_exists()
|
||||
* For plugins that override secondary navigation, the namespace for the custom secondary navigation class has
|
||||
changed. It was (for example) mod_mymodule\local\views\secondary but is now
|
||||
mod_mymodule\navigation\views\secondary. The old location will continue to work, but is deprecated.
|
||||
|
||||
=== 4.0 ===
|
||||
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace mod_assign\local\views;
|
||||
namespace mod_assign\navigation\views;
|
||||
|
||||
use core\navigation\views\secondary as core_secondary;
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace mod_feedback\local\views;
|
||||
namespace mod_feedback\navigation\views;
|
||||
|
||||
use core\navigation\views\secondary as core_secondary;
|
||||
use settings_navigation;
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace mod_glossary\local\views;
|
||||
namespace mod_glossary\navigation\views;
|
||||
|
||||
use core\navigation\views\secondary as core_secondary;
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace mod_label\local\views;
|
||||
namespace mod_label\navigation\views;
|
||||
|
||||
use core\navigation\views\secondary as core_secondary;
|
||||
use settings_navigation;
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace mod_quiz\local\views;
|
||||
namespace mod_quiz\navigation\views;
|
||||
|
||||
use core\navigation\views\secondary as core_secondary;
|
||||
|
||||
Reference in New Issue
Block a user