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

Create a Version compatible with TYPO3 v12.4.x #2

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
30 changes: 19 additions & 11 deletions Classes/Elements/ImagePointElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

namespace Clickstorm\CsImagePoint\Elements;

use Override;
use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity;
use TYPO3\CMS\Backend\Form\Element\AbstractFormElement;
use TYPO3\CMS\Backend\Form\NodeFactory;
use TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException;
Expand All @@ -23,6 +25,17 @@
*/
class ImagePointElement extends AbstractFormElement
{
/**
* Summary of templateView
* @var StandaloneView
*/
protected StandaloneView $templateView;

/**
* Summary of uriBuilder
* @var UriBuilder
*/
protected UriBuilder $uriBuilder;

/**
* Default field information enabled for this element.
Expand Down Expand Up @@ -55,6 +68,7 @@ public function __construct(NodeFactory $nodeFactory, array $data)
$this->uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
}

#[Override]
public function render(): array
{
$parameterArray = $this->data['parameterArray'];
Expand All @@ -71,7 +85,7 @@ public function render(): array
$this->getLanguageService()->sL(
'LLL:EXT:cs_image_point/Resources/Private/Language/locallang.xlf:error.wrongNumberOfImages.header'
),
FlashMessage::ERROR,
ContextualFeedbackSeverity::ERROR,
true
);

Expand All @@ -82,13 +96,7 @@ public function render(): array
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_file_reference');
$result = $queryBuilder
->select('uid')
->from('sys_file_reference')
->where(
$queryBuilder->expr()->eq('uid_foreign', $queryBuilder->createNamedParameter($uidForeign)),
$queryBuilder->expr()->eq('fieldname', $queryBuilder->createNamedParameter($imageFieldName)),
$queryBuilder->expr()->eq('tablenames', $queryBuilder->createNamedParameter($tablename))
)
->execute();
->from('sys_file_reference')->where($queryBuilder->expr()->eq('uid_foreign', $queryBuilder->createNamedParameter($uidForeign)), $queryBuilder->expr()->eq('fieldname', $queryBuilder->createNamedParameter($imageFieldName)), $queryBuilder->expr()->eq('tablenames', $queryBuilder->createNamedParameter($tablename)))->executeQuery();
$result = $result->fetchAllAssociative();
$sysFileReferenceUid = $result[0]['uid'] ?? 0;

Expand All @@ -115,8 +123,8 @@ public function render(): array

$attributes = [
'id' => $fieldId,
'name' => htmlspecialchars($parameterArray['itemFormElName']),
'data-formengine-input-name' => htmlspecialchars($parameterArray['itemFormElName']),
'name' => htmlspecialchars((string) $parameterArray['itemFormElName']),
'data-formengine-input-name' => htmlspecialchars((string) $parameterArray['itemFormElName']),
];

$attributes['placeholder'] = 'Coordinates';
Expand All @@ -136,7 +144,7 @@ public function render(): array
'uri' => $this->getWizardUri($sysFileReferenceUid),
'id' => $fieldId,
'fieldInformationHtml' => $fieldInformationHtml,
'itemValue' => htmlspecialchars($itemValue, ENT_QUOTES),
'itemValue' => htmlspecialchars((string) $itemValue, ENT_QUOTES),
'attributesString' => GeneralUtility::implodeAttributes($attributes, true),
'attributes' => $attributes,
'iconHtml' => $this->iconFactory->getIcon('actions-thumbtack', Icon::SIZE_SMALL)->render(),
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"GPL-2.0-or-later"
],
"require": {
"typo3/cms-core": "^11.5"
"typo3/cms-core": "^12.4"
},
"require-dev": {
"typo3/testing-framework": "*"
Expand Down
2 changes: 1 addition & 1 deletion ext_localconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use Clickstorm\CsImagePoint\Elements\ImagePointElement;

defined('TYPO3_MODE') || die();
defined('TYPO3') || die();

(function () {
$GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry'][1650359230] = [
Expand Down