Skip to content

Commit

Permalink
[!!!][TASK] Harden visibility and usage of FormElementLinkResolverHook
Browse files Browse the repository at this point in the history
  • Loading branch information
eliashaeussler committed Jan 12, 2022
1 parent 90695cf commit 4ffb57b
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions Classes/Hooks/FormElementLinkResolverHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@
* @license GPL-2.0-or-later
* @internal
*/
class FormElementLinkResolverHook implements AfterFormStateInitializedInterface
final class FormElementLinkResolverHook implements AfterFormStateInitializedInterface
{
/**
* @var string Form element type to match
*/
protected $type = 'LinkedCheckbox';
private $type = 'LinkedCheckbox';

/**
* @var FormRuntime The current form runtime
*/
protected $formRuntime;
private $formRuntime;

/**
* Resolve link in label of form elements with type LinkedCheckbox.
Expand All @@ -65,7 +65,7 @@ public function afterFormStateInitialized(FormRuntime $formRuntime): void
* @param FormRuntime $formRuntime
* @param RootRenderableInterface $renderable
*/
protected function processCharacterSubstitution(FormRuntime $formRuntime, RootRenderableInterface $renderable): void
private function processCharacterSubstitution(FormRuntime $formRuntime, RootRenderableInterface $renderable): void
{
$this->formRuntime = $formRuntime;

Expand Down Expand Up @@ -135,7 +135,7 @@ protected function processCharacterSubstitution(FormRuntime $formRuntime, RootRe
* @param GenericFormElement $element
* @return string
*/
protected function buildArgumentFromSingleConfiguration(GenericFormElement $element): string
private function buildArgumentFromSingleConfiguration(GenericFormElement $element): string
{
$properties = $element->getProperties();
$pageUid = (int)$properties['pageUid'];
Expand All @@ -151,7 +151,7 @@ protected function buildArgumentFromSingleConfiguration(GenericFormElement $elem
*
* @return string[]
*/
protected function buildArgumentsFromArrayConfiguration(GenericFormElement $element): array
private function buildArgumentsFromArrayConfiguration(GenericFormElement $element): array
{
if (!$this->hasAdditionalLinksConfigured($element)) {
return [];
Expand Down Expand Up @@ -180,7 +180,7 @@ protected function buildArgumentsFromArrayConfiguration(GenericFormElement $elem
* @param int $pageUid
* @return string
*/
protected function buildArgument(GenericFormElement $element, array $linkTextPropertyPath, int $pageUid): string
private function buildArgument(GenericFormElement $element, array $linkTextPropertyPath, int $pageUid): string
{
$translatedLinkText = $this->translate($element, $linkTextPropertyPath);
$additionalLinkConfiguration = $element->getRenderingOptions()['linkConfiguration'] ?? [];
Expand All @@ -201,7 +201,7 @@ protected function buildArgument(GenericFormElement $element, array $linkTextPro
* @param GenericFormElement $element
* @return bool
*/
protected function hasAdditionalLinksConfigured(GenericFormElement $element): bool
private function hasAdditionalLinksConfigured(GenericFormElement $element): bool
{
$properties = $element->getProperties();

Expand All @@ -215,7 +215,7 @@ protected function hasAdditionalLinksConfigured(GenericFormElement $element): bo
* @param string[] $propertyPath
* @return string
*/
protected function translate(RootRenderableInterface $renderable, array $propertyPath): string
private function translate(RootRenderableInterface $renderable, array $propertyPath): string
{
$translationService = TranslationService::getInstance();
$value = $translationService->translateFormElementValue($renderable, $propertyPath, $this->formRuntime);
Expand All @@ -235,7 +235,7 @@ protected function translate(RootRenderableInterface $renderable, array $propert
* @param array<string, string|int> $additionalAttributes
* @return string
*/
protected function buildLinkFromPageUid(string $linkText, int $pageUid, array $additionalAttributes = []): string
private function buildLinkFromPageUid(string $linkText, int $pageUid, array $additionalAttributes = []): string
{
if (!$pageUid) {
return $linkText;
Expand Down Expand Up @@ -283,7 +283,7 @@ protected function buildLinkFromPageUid(string $linkText, int $pageUid, array $a
* @return bool `true` if character substitution is needed, `false` otherwise
* @see printf()
*/
protected static function needsCharacterSubstitution(string $value): bool
private static function needsCharacterSubstitution(string $value): bool
{
$filteredValue = $value;
do {
Expand Down

0 comments on commit 4ffb57b

Please sign in to comment.