mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 09:56:38 +02:00
MDL-75153 grade: Update the general tertiary nav selector in gradebook
Updates the general tertiary nav selector in gradebook to use the new structure that utilizes the existing select_menu output component.
This commit is contained in:
parent
2b99e648cb
commit
0e1cdfde1d
16 changed files with 405 additions and 224 deletions
|
@ -17,6 +17,7 @@
|
|||
namespace core_grades\output;
|
||||
|
||||
use moodle_url;
|
||||
use core\output\select_menu;
|
||||
|
||||
/**
|
||||
* Renderable class for the general action bar in the gradebook pages.
|
||||
|
@ -65,14 +66,14 @@ class general_action_bar extends action_bar {
|
|||
* @return array
|
||||
*/
|
||||
public function export_for_template(\renderer_base $output): array {
|
||||
$urlselect = $this->get_action_selector();
|
||||
$selectmenu = $this->get_action_selector();
|
||||
|
||||
if (is_null($urlselect)) {
|
||||
if (is_null($selectmenu)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [
|
||||
'generalnavselector' => $urlselect->export_for_template($output),
|
||||
'generalnavselector' => $selectmenu->export_for_template($output),
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -88,9 +89,9 @@ class general_action_bar extends action_bar {
|
|||
/**
|
||||
* Returns the URL selector object.
|
||||
*
|
||||
* @return \url_select|null The URL select object.
|
||||
* @return \select_menu|null The URL select object.
|
||||
*/
|
||||
private function get_action_selector(): ?\url_select {
|
||||
private function get_action_selector(): ?select_menu {
|
||||
if ($this->context->contextlevel !== CONTEXT_COURSE) {
|
||||
return null;
|
||||
}
|
||||
|
@ -186,6 +187,9 @@ class general_action_bar extends action_bar {
|
|||
$menu[][get_string('moremenu')] = $moregroup;
|
||||
}
|
||||
|
||||
return new \url_select($menu, $this->activeurl->out(false), null, 'gradesactionselect');
|
||||
$selectmenu = new select_menu('gradesactionselect', $menu, $this->activeurl->out(false));
|
||||
$selectmenu->set_label(get_string('gradebooknavigationmenu', 'grades'), ['class' => 'sr-only']);
|
||||
|
||||
return $selectmenu;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue