Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Deprecation] renderStatic() for Fluid ViewHelpers #147

Merged
merged 3 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Build/rector/rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/

use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\StaticCall\RemoveParentCallWithoutParentRector;
use Rector\Php74\Rector\LNumber\AddLiteralSeparatorToNumberRector;
use Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector;
use Ssch\TYPO3Rector\CodeQuality\General\ConvertImplicitVariablesToExplicitGlobalsRector;
Expand Down Expand Up @@ -46,13 +47,14 @@
ConvertImplicitVariablesToExplicitGlobalsRector::class,
])
->withConfiguredRule(ExtEmConfRector::class, [
ExtEmConfRector::TYPO3_VERSION_CONSTRAINT => '13.1.0-13.99.99',
ExtEmConfRector::TYPO3_VERSION_CONSTRAINT => '13.3.0-13.99.99',
ExtEmConfRector::ADDITIONAL_VALUES_TO_BE_REMOVED => [],
])
// If you use importNames(), you should consider excluding some TYPO3 files.
->withSkip([
// AddLiteralSeparatorToNumberRector would make the exception codes more readable.
// But as they are just timestamps this is not needed/wanted.
AddLiteralSeparatorToNumberRector::class,
RemoveParentCallWithoutParentRector::class,
])
;
19 changes: 8 additions & 11 deletions Classes/ViewHelpers/GravatarViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use TYPO3\CMS\Core\Utility\HttpUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper;
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;

/*
* This file is part of the TYPO3 CMS project.
Expand All @@ -28,16 +27,18 @@
* See http://www.gravatar.com
* = Examples =
* <code>
* <blog:gravatar emailAddress="[email protected]" size="40" defaultImageUri="someDefaultImage" />
* <blog:gravatar emailAddress="[email protected]"
* size="40"
* defaultImageUri="someDefaultImage"
* alt="Gravator icon of {comment.author}"
* data-name="{comment.author}" />
* </code>
* <output>
* <img src="http://www.gravatar.com/avatar/4a28b782cade3dbcd6e306fa4757849d?d=someDefaultImage&s=40" />
* </output>
*/
class GravatarViewHelper extends AbstractTagBasedViewHelper
{
use CompileWithRenderStatic;

/**
* @var string
*/
Expand All @@ -47,15 +48,11 @@ public function __construct(private readonly UriFactory $uriFactory)
parent::__construct();
}

/**
* Initialize arguments
*/
public function initializeArguments(): void
{
$this->registerUniversalTagAttributes();
$this->registerArgument('emailAddress', 'string', '', true)
->registerArgument('defaultImageUri', 'string', '', false)
->registerArgument('size', 'int', '', false);
$this->registerArgument('emailAddress', 'string', '', true);
$this->registerArgument('defaultImageUri', 'string', '');
$this->registerArgument('size', 'int', '');
}

public function render(): string
Expand Down
9 changes: 8 additions & 1 deletion Resources/Private/Templates/Post/Show.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,14 @@ <h2>
<ol>
<f:for each="{post.comments}" as="comment">
<li>
<blog:gravatar emailAddress="{comment.email}" defaultImageUri="{f:uri.resource(path: 'Icons/default_gravatar.gif', absolute: 1)}" size="40" class="tx-blogexample-gravatar" />
<blog:gravatar
emailAddress="{comment.email}"
defaultImageUri="{f:uri.resource(path: 'EXT:local_packages/blog_example/Resources/Public/Icons/default_gravatar.gif', absolute: 1)}"
linawolf marked this conversation as resolved.
Show resolved Hide resolved
linawolf marked this conversation as resolved.
Show resolved Hide resolved
size="40"
class="tx-blogexample-gravatar"
alt="Gravator icon of {comment.author}"
data-name="{comment.author}"
/>
<f:link.email email="{comment.author}">{comment.author}</f:link.email>
<span class="tx-blogexample-metadata"><f:translate key="postedOn" default="[posted on]" /> {post.date -> f:format.date(format: '{f:translate(key: \'culture.date.formatLong\')}')}</span>
<p>
Expand Down
2 changes: 1 addition & 1 deletion ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
'state' => 'stable',
'constraints' => [
'depends' => [
'typo3' => '13.1.0-13.99.99',
'typo3' => '13.3.0-13.99.99',
],
'conflicts' => [],
'suggests' => [],
Expand Down