Using DI for all hook access means that it becomes significantly easier
to mock hooks and callbacks for unit testing without fundamentally
altering the structure of the code purely for the purposes of unit
testing.
The backup/view.php page has been created to display the list of
course reuse actions available for users.
That way, the "Course reuse" option in the secondary navigation
will display this page instead of redirecting to the first action
available.
Apart from that, the headers for all the Course reuse actions have
been homogenised and the tertiary navigation selector has been included,
to replace headers and make it easier navigate between actions.
Allow pages to choose which course reuse overflow node is selected, to
handle cases where the default selection (based on matching PAGE->url
to the node action URL) isn't possible (such as when several pages need
to exist under the same selected node).
Also ensure that if course reuse contains only a single node (e.g.
reset), then it is still accessible from secondary navigation.
Co-authored-by: Meirza Arson <meirza.arson@moodle.com>
Fixes the site home secondary nav, so that nodes added by plugins
implementing the PLUGIN_extend_navigation_frontpage callback can be
displayed for users who don't have the 'course:update' capability.
This change comprises:
- Removed course:update capability checks from site home (index.php)
and from the secondary nav view. This isn't needed since the nav is
capability aware.
- Fixed the initialisation of the secondary nav for the frontpage
course, removing erroneous duplicate 'home' nodes. The nav is now only
shown if there are nodes to display.
The following change prevents showing the 'Course' item (dropdown) in
the secondary navigation if this dropdown does not contain any items
when using the single activity course format.
* Allow the more menu to be rendered as a tablist when needed.
* Let menu_navigation handle keyboard navigation only when
menu items are not rendered as dropdowns. Otherwise, leave
the keyboard navigation handling via the default handlers
(e.g. dropdown.js/aria.js/tab.js).
* When the more menu is rendered as a tablist, use aria-selected
for the selected tab. When it's rendered as a menu, use aria-current
for the selected menu item. (The menuitem role supports aria-current and
not aria-selected)
* Make sure that the active tab is tabbable by default.
* Submenu items should always have tabindex=-1
* Update behat to use css_element instead of xpath. Also, improved it
to consider that it is the active element that should be tabbable.
Co-authored-by: Shamim Rezaie <shamim@moodle.com>
Creates secondary navigation dedicated for the single activity course
format. To accomodate these chanages a new property
'showchildreninsubmenu' is introduced in navigation_node which can be
used to define whether the node's children should be displayed in a
submenu when applicable. Also, new method get_page() is added in
settings_navigation which can be used to get the $page class property.