Skip to content

Commit

Permalink
Merge pull request #72 from catalyst/issue71-update_for_405
Browse files Browse the repository at this point in the history
Issue #71: Use new 'after_config' hook for Moodle 4.5
  • Loading branch information
tuanngocnguyen authored Dec 2, 2024
2 parents b033b5c + 401a413 commit fb793c4
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
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;

0 comments on commit fb793c4

Please sign in to comment.