abstract_extension
abstract class abstract_extension implements extension_interface
| internal |
Base Extension Class.
All Middag modules must extend this class. It provides the lifecycle hooks (register, boot) and UI metadata (title, icon, grouping).
Constants
| EXTENSION_IDNUMBER |
|
| GROUP |
Discovery-time group hint. Used by loaders before instantiation. |
| REQUIRES |
List of other extension slugs required for this one to function. |
| PRIORITY |
Default priority used to order extensions within the same group. Lower values mean higher precedence (i.e., appear first). |
| HIDDEN |
Whether this extension should be hidden from general UI listings. |
Methods
No description
DI Registration Phase.
Runtime Boot Phase.
Check if the extension is the core component.
Checks if the extension is effectively enabled (Config + Internal).
Internal check (e.g., license check or deprecated status).
Returns whether the extension is flagged as hidden.
Get the name of the extension.
Get the human-readable label of the extension.
Get the current version of the extension.
Get the list of extension slugs required for this extension to operate.
Get the title of the extension.
Get the description of the extension.
Get the type of the extension.
Get the icon of the extension.
Get the categories of the extension.
Extension group for UI organization in settings tabs.
Whether this extension provides Moodle settings to be rendered dynamically.
Check if the resource is available.
Get the badges associated with the extension.
Get the configuration page URL for the extension.
Quick access links for this extension (admin shortcuts).
Get the help URL of the extension.
Get the custom help URL of the extension.
Before element rendering.
After element rendering.
Register controllers via Attributes/Annotations.
Load hooks for this specific extension.
Return admin setting pages for dynamic settings registration.
Get the localized title for the configuration page tab.
Auto-discover controllers in the 'controller' subfolder.
Details
at line 72
__construct()
No description
at line 84
void
register(ContainerInterface $container)
DI Registration Phase.
Override this to define services in the ContainerBuilder before compilation.
at line 94
void
boot()
Runtime Boot Phase.
Called after the container is compiled. Used to register Routes, Hooks (Events), and other runtime logic.
at line 119
bool
is_core()
Check if the extension is the core component.
at line 129
bool
is_enabled()
Checks if the extension is effectively enabled (Config + Internal).
at line 147
bool
is_enabled_internally()
Internal check (e.g., license check or deprecated status).
at line 157
bool
is_hidden()
Returns whether the extension is flagged as hidden.
at line 167
string
get_name()
Get the name of the extension.
at line 178
string
get_label()
Get the human-readable label of the extension.
at line 188
string
get_version()
Get the current version of the extension.
at line 199
array
get_dependencies()
Get the list of extension slugs required for this extension to operate.
at line 211
string
get_title()
Get the title of the extension.
at line 225
string
get_description()
Get the description of the extension.
at line 239
static string
get_type()
Get the type of the extension.
at line 249
string
get_icon()
Get the icon of the extension.
at line 259
array
get_categories()
Get the categories of the extension.
at line 274
extension_group
get_group()
Extension group for UI organization in settings tabs.
Discovery uses the static GROUP constant to avoid instantiation.
At runtime, this method returns the same value, enabling subclasses
to simply define public const GROUP = self::GROUP_*; without the
need to override this method.
at line 283
bool
has_moodle_settings()
Whether this extension provides Moodle settings to be rendered dynamically.
If true, settings.php may build a tab for it.
at line 293
bool
is_available()
Check if the resource is available.
at line 308
array
get_extension_badges()
Get the badges associated with the extension.
severity: secondary, success, info, warn, danger, contrast label: name.
Get UI badges (New, Beta, Pro, etc.). Format: [['severity' => 'success', 'label' => 'New']].
at line 318
moodle_url
get_config_page_url()
Get the configuration page URL for the extension.
at line 335
array
get_quick_access_links()
Quick access links for this extension (admin shortcuts).
Return an array of DTOs: each item as [ 'id' => string (unique), 'title' => string (Already localized), 'url' => moodle_url|string ].
settings.php will render them inside a dedicated tab if non-empty.
at line 345
string
get_help_url()
Get the help URL of the extension.
at line 355
string
get_custom_help_url()
Get the custom help URL of the extension.
at line 365
void
before_render()
Before element rendering.
Used to add stuff before the element.
at line 372
void
after_render()
After element rendering.
Used to add stuff after the element.
at line 381
void
register_controllers()
Register controllers via Attributes/Annotations.
Uses Middag routing helper to map PHP 8 #[Route] attributes.
at line 394
void
register_hooks()
Load hooks for this specific extension.
Scans the hook/ subdirectory for classes with a static register() method.
at line 432
array
get_settings_pages()
Return admin setting pages for dynamic settings registration.
at line 442
string
get_config_page_title()
Get the localized title for the configuration page tab.
at line 458
protected array
get_controllers()
Auto-discover controllers in the 'controller' subfolder.