Skip to content

Commit

Permalink
Move extend_user_menu hook to its own class
Browse files Browse the repository at this point in the history
  • Loading branch information
sharpchi committed Nov 13, 2024
1 parent 2e32435 commit d820096
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

namespace local_accessibilitytool;
namespace local_accessibilitytool\local\hooks;

use core_user\hook\extend_user_menu;
use stdClass;

/**
Expand All @@ -26,14 +25,14 @@
* @copyright 2024 Southampton Solent University {@link https://www.solent.ac.uk}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class hook_callbacks {
class extend_user_menu {
/**
* Extend user menu with accessibility tool.
*
* @param extend_user_menu $hook
* @return void
*/
public static function extend_user_menu(extend_user_menu $hook): void {
public static function callback(\core_user\hook\extend_user_menu $hook): void {
$enabled = get_config('local_accessibilitytool', 'enable');
if (!$enabled) {
return;
Expand Down
2 changes: 1 addition & 1 deletion db/hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
$callbacks = [
[
'hook' => core_user\hook\extend_user_menu::class,
'callback' => '\local_accessibilitytool\hook_callbacks::extend_user_menu',
'callback' => [\local_accessibilitytool\local\hooks\extend_user_menu::class, 'callback'],
'priority' => 0,
],
[
Expand Down
3 changes: 0 additions & 3 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

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

require_once($CFG->dirroot . "/local/accessibilitytool/locallib.php");

/**
* Called by theme's page_init function to set classes and load scripts.
Expand Down
1 change: 0 additions & 1 deletion manage.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

require_once("../../config.php");
require_once("lib.php");
require_once("locallib.php");

require_login();

Expand Down

0 comments on commit d820096

Please sign in to comment.