Skip to content

KICK-275 Configurable order of tertiary navigation pages - #82

Merged
jrchamp merged 2 commits into
mainfrom
KICK-275
Aug 14, 2026
Merged

KICK-275 Configurable order of tertiary navigation pages#82
jrchamp merged 2 commits into
mainfrom
KICK-275

Conversation

@stefanscholz

@stefanscholz stefanscholz commented Jun 9, 2026

Copy link
Copy Markdown
Member

Summary

Adds a global admin setting that defines the order of the pages in the Kickstart tertiary-navigation dropdown (course template, student view, help, plus the Pro course-library and create-template pages). The configured order also determines the default page — the visible page with the lowest order is shown first — and a page set to order 0 is hidden from the dropdown.

As a bonus, when the configuration leaves only a single visible page, the dropdown collapses to a plain page title instead of a one-option selector with a useless toggle arrow.

Changes

  • lib.php — new single source of truth for the page list plus ordering helpers:
    • format_kickstart_get_all_pages() — every available page (base + Pro) in canonical order
    • format_kickstart_get_ordered_pages() — applies the admin order; drops pages set to 0; unset settings keep their canonical position (so a fresh install never hides everything); stable tie-break
    • format_kickstart_get_default_nav() — first visible page, with a safe coursetemplate fallback
    • both menu builders (..._get_breadcump_menus, ..._get_action_selector_menus) are now order-aware; the Pro create-template capability gate is preserved
  • settings.php — a "Navigation page order" heading and one numeric PARAM_INT field per available page (Pro fields appear only when Pro is installed)
  • format.php / list.php — default nav now comes from format_kickstart_get_default_nav() instead of the hardcoded coursetemplate
  • general_action_bar + template — render a bold title (no selector) when only one page is visible, and nothing when all are hidden
  • lang/en — new strings (pageordersettings, pageorder, …) documenting that 0 hides a page and the lowest number is the default
  • version.php — bumped so the new settings register on upgrade

Tests

Added PHPUnit coverage in tests/format_kickstart_test.php:

  • format_kickstart_get_all_pages / _get_ordered_pages (default, reorder, hide)
  • format_kickstart_get_default_nav (lowest-order default + all-hidden fallback)
  • general_action_bar::export_for_template (single-item title vs multi-item selector)

Locally verified with php -l and the Moodle code checker (moodlehq/moodle-cs, --standard=moodle) — clean. PHPUnit/Behat run via this pipeline.

Add a global admin setting that controls the order of the Kickstart
navigation pages (course template, student view, help, and the Pro
course library / create template pages) in the tertiary navigation
dropdown. The order also determines the default page: the visible page
with the lowest order is shown first. A page set to order 0 is hidden.

When the configured order leaves only a single visible page, the
dropdown collapses to a plain page title instead of a pointless
single-option selector.

- lib.php: central page list + ordering/visibility/default helpers,
  and order-aware menu builders
- settings.php: numeric "order" field per available page
- format.php / list.php: default nav derived from the configured order
- general_action_bar: render a title when only one page is visible
- PHPUnit coverage for ordering, hiding, default and the single-item bar

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@stefanscholz

Copy link
Copy Markdown
Member Author

Replace the free-text order inputs with a select dropdown offering
positions 1..N (one per available page) plus a "Hide" option for 0,
so admins pick a valid position instead of typing an arbitrary number.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jrchamp jrchamp mentioned this pull request Jul 23, 2026
@jrchamp
jrchamp merged commit 1c2ca55 into main Aug 14, 2026
8 checks passed
@jrchamp
jrchamp deleted the KICK-275 branch August 14, 2026 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants