class extension_service implements extension_service_interface

internal  
 

Extension Service.

Service responsible for managing the state and settings of extensions. Acts as the bridge between the technical implementation (Classes/Container) and the user experience (UI, Settings, Enabling/Disabling).

Methods

__construct(extension_loader_interface $loader)

Constructor.

extension_interface|null
get(string $slug)

Get a registered extension by its slug.

array
get_all()

Get all registered extension instances.

array
get_active_extensions()

Get only the enabled extension instances.

void
boot_all()

Boot all enabled extensions.

bool
is_enabled(string $slug)

Check if an extension is enabled via Moodle config.

void
enable(string $slug)

Enable an extension in the configuration.

void
disable(string $slug)

Disable an extension in the configuration.

array
list_for_ui()

Prepare data structure for the Frontend/UI listing.

static moodle_url
get_icon_url(string $slug)

Get the URL for the extension icon.

array
resolve_boot_order()

Resolve the order in which extensions should be booted based on dependencies.

bool
validate_dependencies(extension_interface $extension)

Validate if all dependencies for an extension are enabled and available.

Details

at line 56
__construct(extension_loader_interface $loader)

Constructor.

Parameters

extension_loader_interface $loader

at line 67
extension_interface|null get(string $slug)

Get a registered extension by its slug.

Parameters

string $slug

Return Value

extension_interface|null

at line 79
array get_all()

Get all registered extension instances.

Return Value

array

at line 91
array get_active_extensions()

Get only the enabled extension instances.

Return Value

array

at line 111
void boot_all()

Boot all enabled extensions.

This is the "Runtime Entry Point". It registers controllers, hooks, and executes specific boot logic for each enabled extension.

Return Value

void

Exceptions

Exception

at line 143
bool is_enabled(string $slug)

Check if an extension is enabled via Moodle config.

Parameters

string $slug

Return Value

bool

at line 175
void enable(string $slug)

Enable an extension in the configuration.

Parameters

string $slug

Return Value

void

at line 185
void disable(string $slug)

Disable an extension in the configuration.

Parameters

string $slug

Return Value

void

at line 199
array list_for_ui()

Prepare data structure for the Frontend/UI listing.

Return Value

array

Exceptions

Exception

at line 253
static moodle_url get_icon_url(string $slug)

Get the URL for the extension icon.

Parameters

string $slug

Return Value

moodle_url

Exceptions

Exception

at line 275
protected array resolve_boot_order()

Resolve the order in which extensions should be booted based on dependencies.

Return Value

array

Ordered list of slugs

Exceptions

Exception

at line 312
protected bool validate_dependencies(extension_interface $extension)

Validate if all dependencies for an extension are enabled and available.

Parameters

extension_interface $extension

Return Value

bool