Skip to content

Commit

Permalink
11.5 compatibility (#7)
Browse files Browse the repository at this point in the history
* [TASK] added compat for v10 and v11

* [TASK] worked on compat for v10 and v11, removed dead code and fixed some typos

* handle more deprecations, align to recommended file structure

---------

Co-authored-by: Michael Grundkötter <[email protected]>
Co-authored-by: MarcMoschSLUB <[email protected]>
Co-authored-by: Carsten Radeck <[email protected]>
  • Loading branch information
4 people authored Sep 23, 2024
1 parent df25bd1 commit 798553d
Show file tree
Hide file tree
Showing 15 changed files with 67 additions and 384 deletions.
10 changes: 5 additions & 5 deletions Classes/Backend/ItemsProcFunc.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
*
* (c) 2021 Tobias Kreße <[email protected]>, SLUB Dresden
*
*
***/

class ItemsProcFunc
Expand All @@ -18,15 +18,15 @@ class ItemsProcFunc
*
* @param array &$config configuration array
*/
public function user_sameAsSelected(array &$config)
public function user_sameAsSelected(array &$config): void
{
$search = $config['row']['settings.entityfacts.personality'];

//api commmunication and decoding
//api communication and decoding
$apiAnswer = file_get_contents('http://hub.culturegraph.org/entityfacts/' . $search);
$apiAnswerDecode = json_decode ($apiAnswer, true);


//constructing the wanted array
foreach ($apiAnswerDecode['sameAs'] as $item) {
$newItems[] = [$item['collection']['name'],$item['collection']['abbr']];
Expand Down
15 changes: 6 additions & 9 deletions Classes/Controller/EntityFactController.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php
namespace Slub\SlubEntityfacts\Controller;

use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use Psr\Http\Message\ResponseInterface;
/***
*
* This file is part of the "slubentityfacts" Extension for TYPO3 CMS.
Expand All @@ -11,30 +13,26 @@
* (c) 2018 Sebastian Semsker <[email protected]>, SLUB Dresden
*
***/

/**
* EntityFactController
*/
class EntityFactController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
class EntityFactController extends ActionController
{

/**
* action show
*
* @return void
*/
public function showAction()
public function showAction(): ResponseInterface
{
//$entityFacts = $this->entityFactRepository->findAll();

//Get the nine chars long entity facts id from Flexform that the user wants to call
$search = $this->settings['entityfacts']['personality'];

//Get the selected entity type from Flexform
$selection = $this->settings['entityfacts']['selection'];

$arguments = $this->request->getArguments();
//print_r($arguments);

if ($arguments['search']){
$search = $arguments['search'];
Expand All @@ -48,7 +46,7 @@ public function showAction()
$apiAnswer = file_get_contents('https://hub.culturegraph.org/entityfacts/'.$search);
}

//Replace @id for easier calling of informations (no value with "@id" expected)
//Replace @id for easier calling of information (no value with "@id" expected)
$apiAnswerClean = str_replace('"@id"', '"atid"', $apiAnswer);

$apiAnswerDecode = json_decode ($apiAnswerClean, true);
Expand Down Expand Up @@ -98,8 +96,7 @@ public function showAction()

$this->view->assign('sameAsArray', $sameAsArray);
$this->view->assign('viewArray', $viewArray);
//$this->view->assign('multiSelectArray', $multiSelectArray);
$this->view->assign('apiAnswerDecode', $apiAnswerDecode);
//$this->view->assign('entityFact', $entityFact);
return $this->htmlResponse();
}
}
4 changes: 2 additions & 2 deletions Classes/Domain/Model/EntityFact.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
namespace Slub\SlubEntityfacts\Domain\Model;

use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
/***
*
* This file is part of the "slubentityfacts" Extension for TYPO3 CMS.
Expand All @@ -11,11 +12,10 @@
* (c) 2018 Sebastian Semsker <[email protected]>, SLUB Dresden
*
***/

/**
* EntityFact
*/
class EntityFact extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
class EntityFact extends AbstractEntity
{

}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<numIndex index="1">placeOfBirth</numIndex>
</numIndex>
<numIndex index="5" type="array">
<numIndex index="0">Sterbesort</numIndex>
<numIndex index="0">Sterbeort</numIndex>
<numIndex index="1">placeOfDeath</numIndex>
</numIndex>
<numIndex index="6" type="array">
Expand Down
8 changes: 8 additions & 0 deletions Configuration/Icons.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

return [
'user_plugin_entityfactslisting' => [
'provider' => \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class,
'source' => 'EXT:slub_entityfacts/Resources/Public/Icons/user_plugin_entityfactslisting.svg'
],
];
10 changes: 5 additions & 5 deletions Configuration/TCA/Overrides/sys_template.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php
defined('TYPO3_MODE') || die('Access denied.');
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;

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

call_user_func(
function($extKey)
static function($extKey)
{

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile($extKey, 'Configuration/TypoScript', 'SLUB DNB Entity Facts');

ExtensionManagementUtility::addStaticFile($extKey, 'Configuration/TypoScript', 'SLUB DNB Entity Facts');
},
'slub_entityfacts'
);
16 changes: 9 additions & 7 deletions Configuration/TCA/Overrides/tt_content.php
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
<?php
defined('TYPO3_MODE') || die('Access denied.');
use TYPO3\CMS\Extbase\Utility\ExtensionUtility;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;

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

call_user_func(
function($extKey)
static function()
{

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'Slub.SlubEntityfacts',
ExtensionUtility::registerPlugin(
'SlubEntityfacts',
'Entityfactslisting',
'SLUB: DNB Entity Facts'
);

$pluginSignature = 'slubentityfacts_entityfactslisting';
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue(
ExtensionManagementUtility::addPiFlexFormValue(
$pluginSignature,
'FILE:EXT:slub_entityfacts/Configuration/FlexForms/FF_SlubEntityfacts_Entityfactslisting.xml'
);

},
'slub_entityfacts'
}
);
14 changes: 14 additions & 0 deletions Configuration/TsConfig/ContentElementWizard.tsconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
mod.wizards.newContentElement.wizardItems.plugins {
elements {
entityfactslisting {
iconIdentifier = user_plugin_entityfactslisting
title = LLL:EXT:slub_entityfacts/Resources/Private/Language/locallang_db.xlf:tx_slub_entityfacts_domain_model_entityfactslisting
description = LLL:EXT:slub_entityfacts/Resources/Private/Language/locallang_db.xlf:tx_slub_entityfacts_domain_model_entityfactslisting.description
tt_content_defValues {
CType = list
list_type = slubentityfacts_entityfactslisting
}
}
}
show = *
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,4 @@ plugin.tx_slubentityfacts {
}

# cat=plugin.tx_slubentityfacts/file; type=string; label=Path to template root (FE)
[compatVersion = 8.7.0]
plugin.tx_slubentityfacts.view.templateRootPath = EXT:slub_entityfacts/Resources/Private/Templates/
[else]
# backward compatibility TYPO3 version 7.6.x only
plugin.tx_slubentityfacts.view.templateRootPath = EXT:slub_entityfacts/Resources/Private/Templates76/
[global]
plugin.tx_slubentityfacts.view.templateRootPath = EXT:slub_entityfacts/Resources/Private/Templates/
File renamed without changes.
Loading

0 comments on commit 798553d

Please sign in to comment.