[ticket/15214] Adjust core event name and docblock

PHPBB3-15214
This commit is contained in:
rxu 2025-05-21 11:25:35 +07:00
parent 43cf7b73bd
commit ccbdfb49c7
No known key found for this signature in database
GPG key ID: 8117904FEDEFDD17
5 changed files with 24 additions and 10 deletions

View file

@ -42,7 +42,7 @@ class event extends \Twig\TokenParser\AbstractTokenParser
* In case of equal priority values, corresponding template event listeners will be handled in default compilation order. * In case of equal priority values, corresponding template event listeners will be handled in default compilation order.
* If not set, template event listener priority will be assigned to the value of 0. * If not set, template event listener priority will be assigned to the value of 0.
* *
* @event core.twig_tokenparser_constructor * @event core.twig_event_tokenparser_constructor
* @var array template_event_priority_array Array with template event priority assignments per extension namespace * @var array template_event_priority_array Array with template event priority assignments per extension namespace
* Usage: * Usage:
* '<author>_<extension_name>' => [ * '<author>_<extension_name>' => [
@ -50,17 +50,31 @@ class event extends \Twig\TokenParser\AbstractTokenParser
* ], * ],
* *
* Example: * Example:
* 'phpbb_viglink' => [ * class template_event_order implements EventSubscriberInterface
* 'event/acp_help_phpbb_stats_after' => 80, * {
* 'event/overall_footer_after' => 100, * static public function getSubscribedEvents()
* ], * {
* return [
* 'core.twig_event_tokenparser_constructor' => 'set_template_event_priority',
* ];
* }
*
* public function set_template_event_priority($event)
* {
* $template_event_priority_array = $event['template_event_priority_array'];
* $template_event_priority_array['vendor_name'] = [
* 'event/navbar_header_quick_links_after' => -1,
* ];
* $event['template_event_priority_array'] = $template_event_priority_array;
* }
* }
* *
* @since 4.0.0-a1 * @since 4.0.0-a1
*/ */
if ($this->phpbb_dispatcher) if ($this->phpbb_dispatcher)
{ {
$vars = ['template_event_priority_array']; $vars = ['template_event_priority_array'];
extract($this->phpbb_dispatcher->trigger_event('core.twig_tokenparser_constructor', compact($vars))); extract($this->phpbb_dispatcher->trigger_event('core.twig_event_tokenparser_constructor', compact($vars)));
} }
$this->template_event_priority_array = $template_event_priority_array; $this->template_event_priority_array = $template_event_priority_array;

View file

@ -23,7 +23,7 @@ class template_event_order implements EventSubscriberInterface
static public function getSubscribedEvents() static public function getSubscribedEvents()
{ {
return array( return array(
'core.twig_tokenparser_constructor' => 'set_template_event_priority', 'core.twig_event_tokenparser_constructor' => 'set_template_event_priority',
); );
} }

View file

@ -23,7 +23,7 @@ class template_event_order implements EventSubscriberInterface
static public function getSubscribedEvents() static public function getSubscribedEvents()
{ {
return array( return array(
'core.twig_tokenparser_constructor' => 'set_template_event_priority', 'core.twig_event_tokenparser_constructor' => 'set_template_event_priority',
); );
} }

View file

@ -23,7 +23,7 @@ class template_event_order implements EventSubscriberInterface
static public function getSubscribedEvents() static public function getSubscribedEvents()
{ {
return array( return array(
'core.twig_tokenparser_constructor' => 'set_template_event_priority', 'core.twig_event_tokenparser_constructor' => 'set_template_event_priority',
); );
} }

View file

@ -23,7 +23,7 @@ class template_event_order implements EventSubscriberInterface
static public function getSubscribedEvents() static public function getSubscribedEvents()
{ {
return array( return array(
'core.twig_tokenparser_constructor' => 'set_template_event_priority', 'core.twig_event_tokenparser_constructor' => 'set_template_event_priority',
); );
} }