diff --git a/system/hooks.php b/system/hooks.php index f089b102..69bdcfbd 100644 --- a/system/hooks.php +++ b/system/hooks.php @@ -69,6 +69,10 @@ define('HOOK_ADMIN_LOGIN_AFTER_PASSWORD', ++$i); define('HOOK_ADMIN_LOGIN_AFTER_SIGN_IN', ++$i); define('HOOK_ADMIN_ACCOUNTS_SAVE_POST', ++$i); define('HOOK_EMAIL_CONFIRMED', ++$i); +define('HOOK_GUILDS_BEFORE_GUILD_HEADER', ++$i); +define('HOOK_GUILDS_AFTER_GUILD_HEADER', ++$i); +define('HOOK_GUILDS_AFTER_GUILD_INFORMATION', ++$i); +define('HOOK_GUILDS_AFTER_GUILD_MEMBERS', ++$i); define('HOOK_GUILDS_AFTER_INVITED_CHARACTERS', ++$i); const HOOK_FIRST = HOOK_STARTUP; diff --git a/system/pages/highscores.php b/system/pages/highscores.php index 95647893..dd2efa7b 100644 --- a/system/pages/highscores.php +++ b/system/pages/highscores.php @@ -311,7 +311,6 @@ if(config('highscores_balance')) /** @var Twig\Environment $twig */ $twig->display('highscores.html.twig', [ 'highscores' => $highscores, - 'totalRows' => $i - 1, 'list' => $list, 'skill' => $skill, 'skillName' => ($skill == SKILL_FRAGS ? 'Frags' : ($skill == SKILL_BALANCE ? 'Balance' : getSkillName($skill))), diff --git a/system/templates/guilds.view.html.twig b/system/templates/guilds.view.html.twig index 5fef92e7..f3da843e 100644 --- a/system/templates/guilds.view.html.twig +++ b/system/templates/guilds.view.html.twig @@ -1,6 +1,7 @@
+ {{ hook('HOOK_GUILDS_BEFORE_GUILD_HEADER') }} @@ -16,7 +17,9 @@
-
+
+ + {{ hook('HOOK_GUILDS_AFTER_GUILD_HEADER') }} @@ -83,8 +86,10 @@
+
+ + {{ hook('HOOK_GUILDS_AFTER_GUILD_INFORMATION') }} -
@@ -193,7 +198,9 @@
-
+
+ + {{ hook('HOOK_GUILDS_AFTER_GUILD_MEMBERS') }}
@@ -263,9 +270,9 @@
-
+
- {{ hook(constant('HOOK_GUILDS_AFTER_INVITED_CHARACTERS'), { 'guild': guild, 'isLeader': isLeader }) }} + {{ hook('HOOK_GUILDS_AFTER_INVITED_CHARACTERS', { 'guild': guild, 'isLeader': isLeader }) }}
diff --git a/system/templates/highscores.html.twig b/system/templates/highscores.html.twig index 3b9224e2..2e32b7de 100644 --- a/system/templates/highscores.html.twig +++ b/system/templates/highscores.html.twig @@ -48,7 +48,7 @@ {% endif %} - {% if totalRows < 1 %} + {% if highscores|length < 1 %} {% else %} {% set row = 0 %} diff --git a/system/twig.php b/system/twig.php index c4eed802..5eb35c68 100644 --- a/system/twig.php +++ b/system/twig.php @@ -90,15 +90,16 @@ $function = new TwigFunction('truncate', function ($s, $n) { }); $twig->addFunction($function); -$function = new TwigFunction('hook', function ($hook, array $params = []) { +$function = new TwigFunction('hook', function ($context, $hook, array $params = []) { global $hooks; if(is_string($hook)) { $hook = constant($hook); } + $params['context'] = $context; $hooks->trigger($hook, $params); -}); +}, ['needs_context' => true]); $twig->addFunction($function); $function = new TwigFunction('config', function ($key) {
No records yet.