1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-04-20 15:53:14 +02:00

[ticket/13508] Add include_css() and fix include_js() code linting issues

PHPBB3-13508
This commit is contained in:
Marc Alexander 2021-10-07 21:19:35 +02:00
parent 7efddcef54
commit 02e5a7afc4
No known key found for this signature in database
GPG Key ID: 50E0D2423696F995
5 changed files with 74 additions and 5 deletions

View File

@ -62,6 +62,7 @@ class extension extends \Twig\Extension\AbstractExtension
new \phpbb\template\twig\tokenparser\includeparser,
new \phpbb\template\twig\tokenparser\include_js,
new \phpbb\template\twig\tokenparser\includejs,
new \phpbb\template\twig\tokenparser\include_css,
new \phpbb\template\twig\tokenparser\includecss,
new \phpbb\template\twig\tokenparser\event($this->environment),
new \phpbb\template\twig\tokenparser\includephp($this->environment),

View File

@ -0,0 +1,27 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
namespace phpbb\template\twig\tokenparser;
class include_css extends includecss
{
/**
* Gets the tag name associated with this token parser.
*
* @return string The tag name
*/
public function getTag(): string
{
return 'include_css';
}
}

View File

@ -13,11 +13,6 @@
namespace phpbb\template\twig\tokenparser;
use Twig\Error\SyntaxError;
use Twig\Node\Node;
use Twig\Token;
use Twig\TokenParser\AbstractTokenParser;
class include_js extends includejs
{
/**

View File

@ -0,0 +1,10 @@
<!-- IF TEST === 1 -->
<!-- INCLUDECSS child_only.css -->
<!-- ELSEIF TEST === 2 -->
<!-- INCLUDECSS parent_only.css -->
<!-- ELSEIF TEST === 3 -->
<!-- INCLUDECSS @include_css/test.css -->
<!-- ELSEIF TEST === 4 -->
<!-- INCLUDECSS @include_css/child_only.css -->
<!-- ENDIF -->
{$STYLESHEETS}

View File

@ -0,0 +1,36 @@
<!-- IF TEST === 1 -->
<!-- INCLUDEJS parent_and_child.js -->
<!-- ELSEIF TEST === 2 -->
<!-- INCLUDEJS parent_and_child.js?assets_version=0 -->
<!-- ELSEIF TEST === 3 -->
<!-- INCLUDEJS parent_and_child.js?test=1&assets_version=0 -->
<!-- ELSEIF TEST === 4 -->
<!-- INCLUDEJS parent_and_child.js?test=1&amp;assets_version=0 -->
<!-- ELSEIF TEST === 6 -->
<!-- INCLUDEJS {PARENT} -->
<!-- ELSEIF TEST === 7 -->
<!-- DEFINE $TEST = 'child_only.js' -->
<!-- INCLUDEJS {$TEST} -->
<!-- ELSEIF TEST === 8 -->
<!-- INCLUDEJS subdir/{PARENT} -->
<!-- ELSEIF TEST === 9 -->
<!-- INCLUDEJS {SUBDIR}/subsubdir/{PARENT} -->
<!-- ELSEIF TEST === 10 -->
<!-- INCLUDEJS {SUBDIR}/parent_only.{EXT} -->
<!-- ELSEIF TEST === 11 -->
<!-- DEFINE $TEST = 'child_only.js?test1=1&amp;test2=2#test3' -->
<!-- INCLUDEJS {$TEST} -->
<!-- ELSEIF TEST === 12 -->
<!-- INCLUDEJS parent_only.js?test1=1&amp;test2=2#test3 -->
<!-- ELSEIF TEST === 14 -->
<!-- INCLUDEJS parent_only.js?test1=&quot;#test3 -->
<!-- ELSEIF TEST === 15 -->
<!-- INCLUDEJS http://phpbb.com/b.js?c=d#f -->
<!-- ELSEIF TEST === 16 -->
<!-- INCLUDEJS http://phpbb.com/b.js?c=d&assets_version=2#f -->
<!-- ELSEIF TEST === 17 -->
<!-- INCLUDEJS //phpbb.com/b.js -->
<!-- ELSEIF TEST === 18 -->
<!-- INCLUDEJS parent_and_child.js?test=1&test2=0 -->
<!-- ENDIF -->
{$SCRIPTS}