Commit 5ab50fcc authored by Michal Cygankiewicz's avatar Michal Cygankiewicz

Merge branch 'feature/add-mapper-for-versionnumber' into 'develop'

Add version number mapper

See merge request !445
parents ae1bd616 d58b06c8
Pipeline #7888 passed with stages
in 6 minutes and 11 seconds
<?php
namespace T3o\TerFe2\Routing\Aspect;
/*
* This file is part of a TYPO3 extension.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
class VersionMapper implements \TYPO3\CMS\Core\Routing\Aspect\StaticMappableAspectInterface
{
/**
* @var string
*/
protected $versionRegExp = '/(\d+)\.(\d+)\.(\d+)/';
/**
* @param string $value
* @return string|null
*/
public function generate(string $value): ?string
{
return preg_match($this->versionRegExp, $value) ? $value : null;
}
/**
* @param string $value
* @return string|null
*/
public function resolve(string $value): ?string
{
return preg_match($this->versionRegExp, $value) ? $value : null;
}
}
......@@ -12,4 +12,11 @@ routeEnhancers:
extensionKey:
type: PersistedAliasMapper
tableName: 'tx_terfe2_domain_model_extension'
routeFieldName: 'ext_key'
\ No newline at end of file
routeFieldName: 'ext_key'
versionString:
type: VersionMapper
format:
type: StaticValueMapper
map:
t3x: t3x
zip: zip
\ No newline at end of file
......@@ -96,3 +96,5 @@ $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\T3o\TerFe2\Task
];
$GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['ter_fe2:extension'] = 'EXT:ter_fe2/Classes/Controller/Eid/ExtensionController.php';
$GLOBALS['TYPO3_CONF_VARS']['SYS']['routing']['aspects']['VersionMapper'] = \T3o\TerFe2\Routing\Aspect\VersionMapper::class;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment