From b3e02671bc19cf0cd4a0cf749eaccbf05a2187cc Mon Sep 17 00:00:00 2001 From: Luca Pipolo Date: Wed, 27 Mar 2024 18:15:17 +0100 Subject: [PATCH] refactor: method set as static --- src/class-timber.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/class-timber.php b/src/class-timber.php index db6f84f..f98947b 100644 --- a/src/class-timber.php +++ b/src/class-timber.php @@ -92,7 +92,7 @@ public function get_menus( array $context ): array { #[Filter( 'timber/twig' )] public function extend_timber_functions( TwigEnvironment $twig ): TwigEnvironment { $twig->addFunction( - new TwigFunction( 'enqueue_script', __CLASS__ . '::enqueue_script' ) + new TwigFunction( 'enqueue_script', array( $this, 'enqueue_script' ) ) ); $twig->addFunction( @@ -111,7 +111,7 @@ public function extend_timber_functions( TwigEnvironment $twig ): TwigEnvironmen * * @param string $handle The script handle. */ - public static function enqueue_script( string $handle ): void { + public function enqueue_script( string $handle ): void { wp_enqueue_script( $handle ); }