Skip to content

Commit

Permalink
Merge pull request #31 from Leuchtfeuer/feature/v12
Browse files Browse the repository at this point in the history
Feature/v12
  • Loading branch information
balasch committed Mar 5, 2024
2 parents 8881ee6 + 65e842a commit 2eb40d9
Show file tree
Hide file tree
Showing 26 changed files with 234 additions and 158 deletions.
1 change: 0 additions & 1 deletion .github/FUNDING.yml
@@ -1,2 +1 @@
custom: ["https://www.Leuchtfeuer.com"]
github: flossels
2 changes: 1 addition & 1 deletion .php_cs
Expand Up @@ -12,7 +12,7 @@ This file is part of the "Image Gallery" extension for TYPO3 CMS.
For the full copyright and license information, please read the
LICENSE.txt file that was distributed with this source code.
Florian Wessels <f.wessels@Leuchtfeuer.com>, Leuchtfeuer Digital Marketing
Dev <dev@Leuchtfeuer.com>, Leuchtfeuer Digital Marketing
COMMENT;


Expand Down
20 changes: 8 additions & 12 deletions Classes/Controller/ListController.php
Expand Up @@ -8,13 +8,14 @@
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* Florian Wessels <f.wessels@Leuchtfeuer.com>, Leuchtfeuer Digital Marketing
* Dev <dev@Leuchtfeuer.com>, Leuchtfeuer Digital Marketing
*/

namespace Leuchtfeuer\BmImageGallery\Controller;

use Leuchtfeuer\BmImageGallery\Domain\Repository\FileCollectionRepository;
use Leuchtfeuer\BmImageGallery\Domain\Transfer\CollectionInfo;
use Psr\Http\Message\ResponseInterface;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use TYPO3\CMS\Core\Resource\Collection\AbstractFileCollection;
Expand All @@ -33,7 +34,7 @@ public function __construct(FileCollectionRepository $fileCollectionRepository)
$this->fileCollectionRepository = $fileCollectionRepository;
}

public function listAction(): void
public function listAction(): ResponseInterface
{
$collectionInfos = [];
$fileCollections = $this->fileCollectionRepository->getFileCollectionsToDisplay($this->settings['collections'] ?? '', true);
Expand All @@ -59,23 +60,18 @@ public function listAction(): void
}

$this->view->assign('items', $collectionInfos);
return $this->htmlResponse();
}

/**
* @throws Exception\ResourceDoesNotExistException
* @throws NoSuchArgumentException
*/
public function galleryAction(): void
public function galleryAction(): ResponseInterface
{
$this->view->assignMultiple($this->getCollection($this->request->getArgument('show')));
}

/**
* @throws Exception\ResourceDoesNotExistException
*/
public function selectedGalleryAction(): void
{
$this->view->assignMultiple($this->getCollection((string)$this->settings['collection']));
$identifier = $this->settings['collection'] ?? $this->request->getQueryParams()['tx_bmimagegallery_gallerylist']['show'] ?? 0;
$this->view->assignMultiple($this->getCollection((string)$identifier));
return $this->htmlResponse();
}

/**
Expand Down
6 changes: 3 additions & 3 deletions Classes/Domain/Repository/FileCollectionRepository.php
Expand Up @@ -8,7 +8,7 @@
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* Florian Wessels <f.wessels@Leuchtfeuer.com>, Leuchtfeuer Digital Marketing
* Dev <dev@Leuchtfeuer.com>, Leuchtfeuer Digital Marketing
*/

namespace Leuchtfeuer\BmImageGallery\Domain\Repository;
Expand Down Expand Up @@ -131,8 +131,8 @@ protected function getLocalizedFileCollection(int &$fileCollectionUid)
->from(self::TABLE_NAME)
->where($queryBuilder->expr()->eq($this->languageField, $queryBuilder->createNamedParameter($this->languageUid, \PDO::PARAM_INT)))
->andWhere($queryBuilder->expr()->eq($this->languagePointer, $queryBuilder->createNamedParameter($fileCollectionUid, \PDO::PARAM_INT)))
->execute()
->fetchColumn();
->executeQuery()
->fetchOne();

if ($localizedFileCollection) {
$fileCollectionUid = (int)$localizedFileCollection;
Expand Down
6 changes: 3 additions & 3 deletions Classes/Domain/Transfer/CollectionInfo.php
Expand Up @@ -8,7 +8,7 @@
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* Florian Wessels <f.wessels@Leuchtfeuer.com>, Leuchtfeuer Digital Marketing
* Dev <dev@Leuchtfeuer.com>, Leuchtfeuer Digital Marketing
*/

namespace Leuchtfeuer\BmImageGallery\Domain\Transfer;
Expand Down Expand Up @@ -128,8 +128,8 @@ protected function loadGalleryData()
->select('bm_image_gallery_description', 'bm_image_gallery_location', 'bm_image_gallery_date')
->from('sys_file_collection')
->where($queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($this->identifier, \PDO::PARAM_INT)))
->execute()
->fetch();
->executeQuery()
->fetchAssociative();

$this->setDescription($properties['bm_image_gallery_description'] ?? '');
$this->setLocation($properties['bm_image_gallery_location'] ?? '');
Expand Down
2 changes: 1 addition & 1 deletion Classes/Factory/FileFactory.php
Expand Up @@ -8,7 +8,7 @@
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* Florian Wessels <f.wessels@Leuchtfeuer.com>, Leuchtfeuer Digital Marketing
* Dev <dev@Leuchtfeuer.com>, Leuchtfeuer Digital Marketing
*/

namespace Leuchtfeuer\BmImageGallery\Factory;
Expand Down
42 changes: 23 additions & 19 deletions Classes/Updates/PluginUpdateWizard.php
Expand Up @@ -6,16 +6,19 @@
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* Florian Wessels <f.wessels@Leuchtfeuer.com>, Leuchtfeuer Digital Marketing
* Dev <dev@Leuchtfeuer.com>, Leuchtfeuer Digital Marketing
*/

namespace Leuchtfeuer\BmImageGallery\Updates;

use Symfony\Component\Console\Output\OutputInterface;
use TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Install\Attribute\UpgradeWizard;
use TYPO3\CMS\Install\Updates\UpgradeWizardInterface;

#[UpgradeWizard('bmImageGallery_plugin')]
class PluginUpdateWizard implements UpgradeWizardInterface
{
private const SOURCE_LIST_TYPE = 'bmimagegallery_list';
Expand All @@ -27,14 +30,13 @@ class PluginUpdateWizard implements UpgradeWizardInterface
];

/**
* Return the identifier for this wizard
* This should be the same string as used in the ext_localconf class registration
*
* @return string
* @var OutputInterface
*/
public function getIdentifier(): string
protected $output;

public function setOutput(OutputInterface $output): void
{
return self::class;
$this->output = $output;
}

/**
Expand Down Expand Up @@ -81,7 +83,9 @@ public function executeUpdate(): bool
->set('pi_flexform', $flexForm ?? '')
->set('list_type', $listType)
->where($queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($plugin['uid'], \PDO::PARAM_INT)))
->execute();
->executeStatement();

$this->output->writeln('Updated plugin with UID ' . $plugin['uid']);
}

return true;
Expand Down Expand Up @@ -120,8 +124,8 @@ protected function getPlugins(): array
->select('*')
->from('tt_content')
->where(sprintf('list_type = "%s"', static::SOURCE_LIST_TYPE))
->execute()
->fetchAll();
->executeQuery()
->fetchAllAssociative();
}

protected function getTargetListType(array $flexForm): string
Expand All @@ -140,16 +144,16 @@ protected function transformFlexFormStructure(array $flexForm, string $listType)

$sDEFSettings = [
'settings.collections' => [
'vDEF' => $flexForm['data']['sDEF']['lDEF']['settings.collections']['vDEF']
'vDEF' => $flexForm['data']['sDEF']['lDEF']['settings.collections']['vDEF'],
],
'settings.mode' => [
'vDEF' => $mode
'vDEF' => $mode,
],
];

if ($mode == 1) {
$sDEFSettings['settings.galleryPage'] = [
'vDEF' => $flexForm['data']['sDEF']['lDEF']['settings.galleryPage']['vDEF']
'vDEF' => $flexForm['data']['sDEF']['lDEF']['settings.galleryPage']['vDEF'],
];
}

Expand All @@ -158,8 +162,8 @@ protected function transformFlexFormStructure(array $flexForm, string $listType)
case 'bmimagegallery_selectedgallery':
$sDEFSettings = [
'settings.collection' => [
'vDEF' => $flexForm['data']['sDEF']['lDEF']['settings.collection']['vDEF']
]
'vDEF' => $flexForm['data']['sDEF']['lDEF']['settings.collection']['vDEF'],
],
];
break;
}
Expand All @@ -175,14 +179,14 @@ protected function transformFlexFormStructure(array $flexForm, string $listType)
if (($mode ?? null) != 1) {
$data['data']['list']['lDEF'] = [
'settings.maxItems' => [
'vDEF' => $flexForm['data']['sDEF']['list']['settings.maxItems']['vDEF'] ?? 0
'vDEF' => $flexForm['data']['sDEF']['list']['settings.maxItems']['vDEF'] ?? 0,
],
'settings.orderBy' => [
'vDEF' => $flexForm['data']['sDEF']['list']['settings.orderBy']['vDEF']
'vDEF' => $flexForm['data']['sDEF']['list']['settings.orderBy']['vDEF'],
],
'settings.sortingOrder' => [
'vDEF' => $flexForm['data']['sDEF']['list']['settings.sortingOrder']['vDEF']
]
'vDEF' => $flexForm['data']['sDEF']['list']['settings.sortingOrder']['vDEF'],
],
];
}

Expand Down
10 changes: 10 additions & 0 deletions Configuration/Icons.php
@@ -0,0 +1,10 @@
<?php

use TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider;

return [
'bm-image-gallery' => [
'provider' => SvgIconProvider::class,
'source' => 'EXT:bm_image_gallery/Resources/Public/Icons/Extension.svg'
],
];
4 changes: 4 additions & 0 deletions Configuration/Services.yaml
Expand Up @@ -3,3 +3,7 @@ services:
autowire: true
autoconfigure: true
public: false

Leuchtfeuer\BmImageGallery\:
resource: '../Classes/*'
exclude: '../Classes/Domain/Model/*'
96 changes: 51 additions & 45 deletions Configuration/TCA/Overrides/sys_file_collection.php
@@ -1,53 +1,59 @@
<?php
declare(strict_types = 1);
defined('TYPO3_MODE') || die('Access denied.');

$temporaryColumns = [
'bm_image_gallery_path_segment' => [
'label' => 'LLL:EXT:bm_image_gallery/Resources/Private/Language/locallang_be.xlf:bm_image_gallery_path_segment',
'config' => [
'type' => 'slug',
'generatorOptions' => [
'fields' => ['title'],
'prefixParentPageSlug' => false,
'replacements' => [
'/' => '-',
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;

defined('TYPO3') || die('Access denied.');

call_user_func(
function ($extensionKey) {
$temporaryColumns = [
'bm_image_gallery_path_segment' => [
'label' => 'LLL:EXT:bm_image_gallery/Resources/Private/Language/locallang_be.xlf:bm_image_gallery_path_segment',
'config' => [
'type' => 'slug',
'generatorOptions' => [
'fields' => ['title'],
'prefixParentPageSlug' => false,
'replacements' => [
'/' => '-',
],
],
'fallbackCharacter' => '-',
'prependSlash' => false,
'eval' => 'uniqueInPid',
],
],
'bm_image_gallery_location' => [
'label' => 'LLL:EXT:bm_image_gallery/Resources/Private/Language/locallang_be.xlf:bm_image_gallery_location',
'config' => [
'type' => 'input',
'size' => 30,
'eval' => 'trim',
],
],
'bm_image_gallery_date' => [
'label' => 'LLL:EXT:bm_image_gallery/Resources/Private/Language/locallang_be.xlf:bm_image_gallery_date',
'config' => [
'default' => 0,
'type' => 'datetime',
'format' => 'datetime',
],
],
'bm_image_gallery_description' => [
'label' => 'LLL:EXT:bm_image_gallery/Resources/Private/Language/locallang_be.xlf:bm_image_gallery_description',
'config' => [
'type' => 'text',
'enableRichtext' => true,
],
],
'fallbackCharacter' => '-',
'prependSlash' => false,
'eval' => 'uniqueInPid',
],
],
'bm_image_gallery_location' => [
'label' => 'LLL:EXT:bm_image_gallery/Resources/Private/Language/locallang_be.xlf:bm_image_gallery_location',
'config' => [
'type' => 'input',
'size' => 30,
'eval' => 'trim',
],
],
'bm_image_gallery_date' => [
'label' => 'LLL:EXT:bm_image_gallery/Resources/Private/Language/locallang_be.xlf:bm_image_gallery_date',
'config' => [
'default' => 0,
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'datetime,int',
],
],
'bm_image_gallery_description' => [
'label' => 'LLL:EXT:bm_image_gallery/Resources/Private/Language/locallang_be.xlf:bm_image_gallery_description',
'config' => [
'type' => 'text',
'enableRichtext' => true,
],
],
];
];

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('sys_file_collection', $temporaryColumns);
ExtensionManagementUtility::addTCAcolumns('sys_file_collection', $temporaryColumns);

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
'sys_file_collection',
'--div--;LLL:EXT:bm_image_gallery/Resources/Private/Language/locallang_be.xlf:bm_image_gallery_tab,' . implode(',', array_keys($temporaryColumns)) . ','
ExtensionManagementUtility::addToAllTCAtypes(
'sys_file_collection',
'--div--;LLL:EXT:bm_image_gallery/Resources/Private/Language/locallang_be.xlf:bm_image_gallery_tab,' . implode(',', array_keys($temporaryColumns)) . ','
);
}, 'bm_image_gallery'
);
7 changes: 5 additions & 2 deletions Configuration/TCA/Overrides/sys_template.php
@@ -1,10 +1,13 @@
<?php
declare(strict_types = 1);
defined('TYPO3_MODE') || die('Access denied.');

use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;

defined('TYPO3') || die('Access denied.');

call_user_func(
function ($extensionKey) {
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
ExtensionManagementUtility::addStaticFile(
$extensionKey,
'Configuration/TypoScript',
'Simple Image Gallery'
Expand Down

0 comments on commit 2eb40d9

Please sign in to comment.