-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from slub/dev
Dev
- Loading branch information
Showing
29 changed files
with
558 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Slub\LisztCommon\ViewHelpers; | ||
|
||
use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface; | ||
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; | ||
|
||
use Quellenform\Iconpack\IconpackFactory; | ||
|
||
|
||
final class ItemTypeIconNameViewHelper extends AbstractViewHelper | ||
{ | ||
public function initializeArguments(): void | ||
{ | ||
$this->registerArgument('iconPackKey', 'string', 'Name of the key for the IconPack (from Iconpack.yaml)', true); | ||
$this->registerArgument('itemType', 'string', 'Name of the itemType (from Zotero)', true); | ||
} | ||
|
||
public static function renderStatic( | ||
array $arguments, | ||
\Closure $renderChildrenClosure, | ||
RenderingContextInterface $renderingContext) | ||
: ?string | ||
{ | ||
// get installed icon names from the t3x Iconpack Extension with Key 'lziconsr' as Array | ||
$iconpackFactory = GeneralUtility::makeInstance(IconpackFactory::class); | ||
$iconPackKey = $arguments['iconPackKey']; | ||
$availableIconsArray = $iconpackFactory->queryConfig($iconPackKey, 'icons'); | ||
|
||
// Check if itemType exists as a key in the array | ||
$itemType = $arguments['itemType']; | ||
if (array_key_exists($itemType, $availableIconsArray)) { | ||
return $iconPackKey.','.$itemType; | ||
} | ||
|
||
// else Return default icon | ||
return 'lziconsr,lisztDocument'; | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
declare(strict_types=1); | ||
namespace Slub\LisztCommon\ViewHelpers; | ||
use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface; | ||
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; | ||
|
||
final class SearchParamsViewHelper extends AbstractViewHelper | ||
{ | ||
public function initializeArguments(): void | ||
{ | ||
$this->registerArgument('action', 'string', 'the operation to be performed with the search parameters', true); | ||
$this->registerArgument('key', 'string', 'the key wich has to be operated (added oder removed) ', true); | ||
$this->registerArgument('value', 'string', 'the value if is a add operation', false); | ||
$this->registerArgument('searchParamsArray', 'array', 'the Array with SearchParams from Controller', true); | ||
} | ||
public static function renderStatic( | ||
array $arguments, | ||
\Closure $renderChildrenClosure, | ||
RenderingContextInterface $renderingContext) | ||
: ?array | ||
{ | ||
$action = $arguments['action']; | ||
$key = $arguments['key']; | ||
$value = $arguments['value'] ?? null; | ||
$searchParamsArray = $arguments['searchParamsArray']; | ||
|
||
if ($action === 'add') { | ||
$searchParamsArray[$key] = $value; | ||
} elseif ($action === 'remove') { | ||
unset($searchParamsArray[$key]); | ||
} | ||
|
||
// Convert the array to a string formatted as {key: 'value', key2: 'value2'} | ||
$formattedParams = []; | ||
foreach ($searchParamsArray as $paramKey => $paramValue) { | ||
$formattedParams[] = "{$paramKey}: '" . $paramValue . "'"; | ||
} | ||
|
||
// return '{' . implode(', ', $formattedParams) . '}'; | ||
return ['searchParams' => $searchParamsArray]; | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
iconpack: | ||
title: "Liszt Custom Icons for Search Results in LQWV" | ||
# The key of the iconpack (!) | ||
key: "lziconsr" | ||
version: 1.0.0 | ||
|
||
renderTypes: | ||
svg: | ||
# Source folder of the SVG files, which are rendered as <img> tag: | ||
source: "EXT:liszt_common/Resources/Public/Icons/IconPackSearchResults/" | ||
attributes: | ||
class: "lzicon" | ||
|
||
svgInline: | ||
# Source folder of the SVG files that are rendered as <svg> tag (inline SVG): | ||
source: "EXT:liszt_common/Resources/Public/Icons/IconPackSearchResults/" | ||
attributes: | ||
class: "lzicon-inline" | ||
fill: "currentColor" | ||
|
||
|
||
svgSprite: | ||
source: "EXT:liszt_common/Resources/Public/Icons/IconPackSearchResults/IconSpritesSearchResults.svg" | ||
attributes: | ||
class: "lzicon-sprite" | ||
fill: "currentColor" | ||
|
||
# Define here which icons are provided by this iconpack | ||
# In this case, the values here correspond to the file names (without file name extension) | ||
icons: | ||
- auctionCatalog | ||
- lisztDocument | ||
- book | ||
- attachment | ||
- encyclopediaArticle | ||
- essay | ||
- journalArticle | ||
- lisztDocument | ||
- musicSheet | ||
- thesis | ||
- performance | ||
- profession | ||
- birth | ||
- corporation | ||
- open-access | ||
- place | ||
- person | ||
- death | ||
- work |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.