Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #71: Use new 'after_config' hook for Moodle 4.5 #72

Merged
merged 4 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions classes/hook_callbacks.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,19 @@ public static function before_footer_html_generation(\core\hook\output\before_fo

tool_abconfig_execute_js('footer');
}

/**
* Runs after config has been set.
*
* @param \core\hook\after_config $hook
* @return void|null
*/
public static function after_config(\core\hook\after_config $hook) {
if (during_initial_install() || !get_config('tool_abconfig', 'version')) {
// Do nothing if plugin install not completed.
return;
}

tool_abconfig_after_config();
}
}
5 changes: 5 additions & 0 deletions db/hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,9 @@
'callback' => '\tool_abconfig\hook_callbacks::before_footer_html_generation',
'priority' => 0,
],
[
'hook' => \core\hook\after_config::class,
'callback' => '\tool_abconfig\hook_callbacks::after_config',
'priority' => 0,
],
];
4 changes: 4 additions & 0 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@

/**
* After config
*
* This is a legacy callback that is used for compatibility with older Moodle versions.
* Moodle 4.4+ will use tool_abconfig\hook_callbacks::after_config instead.
*
* @return void|null
*/
function tool_abconfig_after_config() {
Expand Down
6 changes: 3 additions & 3 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2024060400; // The current plugin version (Date: YYYYMMDDXX).
$plugin->release = 2024060400; // Same as version.
$plugin->version = 2024060401; // The current plugin version (Date: YYYYMMDDXX).
$plugin->release = 2024060401; // Same as version.
$plugin->requires = 2014051217;
$plugin->supported = [38, 404]; // Available as of Moodle 3.8.0 or later.
$plugin->supported = [38, 405]; // Available as of Moodle 3.8.0 or later.
$plugin->component = "tool_abconfig";
$plugin->maturity = MATURITY_STABLE;
Loading