Skip to content

Commit

Permalink
[TASK] Remove supports for long deprecated template path names
Browse files Browse the repository at this point in the history
Removes support for:

* templateRootPath (string)
* partialRootPath (string)
* layoutRootPath (string)
* overlays.* (array w/ array or strings)

Preserves support for:

* templateRootPaths (array)
* partialRootPaths (array)
* layoutRootPaths (array)
  • Loading branch information
NamelessCoder committed Apr 9, 2016
1 parent 706f35c commit 843f52f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 68 deletions.
4 changes: 0 additions & 4 deletions Classes/Utility/PathUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,8 @@ class PathUtility {
* @var array
*/
private static $knownPathNames = array(
TemplatePaths::CONFIG_OVERLAYS,
TemplatePaths::CONFIG_TEMPLATEROOTPATH,
TemplatePaths::CONFIG_TEMPLATEROOTPATHS,
TemplatePaths::CONFIG_LAYOUTROOTPATH,
TemplatePaths::CONFIG_LAYOUTROOTPATHS,
TemplatePaths::CONFIG_PARTIALROOTPATH,
TemplatePaths::CONFIG_PARTIALROOTPATHS
);

Expand Down
27 changes: 1 addition & 26 deletions Classes/View/TemplatePaths.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,9 @@ class TemplatePaths {
const DEFAULT_LAYOUTS_DIRECTORY = 'Resources/Private/Layouts/';
const DEFAULT_PARTIALS_DIRECTORY = 'Resources/Private/Partials/';
const DEFAULT_FORMAT = 'html';
const CONFIG_TEMPLATEROOTPATH = 'templateRootPath';
const CONFIG_TEMPLATEROOTPATHS = 'templateRootPaths';
const CONFIG_LAYOUTROOTPATH = 'layoutRootPath';
const CONFIG_LAYOUTROOTPATHS = 'layoutRootPaths';
const CONFIG_PARTIALROOTPATH = 'partialRootPath';
const CONFIG_PARTIALROOTPATHS = 'partialRootPaths';
const CONFIG_OVERLAYS = 'overlays';

/**
* @var array
Expand Down Expand Up @@ -318,8 +314,7 @@ protected function extractPathArrays(array $paths) {
$templateRootPaths = array();
$layoutRootPaths = array();
$partialRootPaths = array();
// first recorded: the modern plural paths configurations:
// checked as first candidates; sorted reverse by key to
// Modern plural paths configurations: sorted reverse by key to
// check the path with the highest number first.
if (TRUE === isset($paths[self::CONFIG_TEMPLATEROOTPATHS]) && TRUE === is_array($paths[self::CONFIG_TEMPLATEROOTPATHS])) {
krsort($paths[self::CONFIG_TEMPLATEROOTPATHS], SORT_NUMERIC);
Expand All @@ -333,26 +328,6 @@ protected function extractPathArrays(array $paths) {
krsort($paths[self::CONFIG_PARTIALROOTPATHS], SORT_NUMERIC);
$partialRootPaths = array_merge($partialRootPaths, array_values($paths[self::CONFIG_PARTIALROOTPATHS]));
}
// second recorded: the legacy "overlays." configurations
// by recursive call to extraction method:
if (TRUE === isset($paths[self::CONFIG_OVERLAYS])) {
foreach ($paths[self::CONFIG_OVERLAYS] as $overlayGroup) {
list ($overlayTemplates, $overlayLayouts, $overlayPartials) = $this->extractPathArrays($overlayGroup);
$templateRootPaths = array_merge($templateRootPaths, $overlayTemplates);
$layoutRootPaths = array_merge($layoutRootPaths, $overlayLayouts);
$partialRootPaths = array_merge($partialRootPaths, $overlayPartials);
}
}
// last appended if set: the legacy singular paths configuration
if (TRUE === isset($paths[self::CONFIG_TEMPLATEROOTPATH])) {
$templateRootPaths[] = $paths[self::CONFIG_TEMPLATEROOTPATH];
}
if (TRUE === isset($paths[self::CONFIG_LAYOUTROOTPATH])) {
$layoutRootPaths[] = $paths[self::CONFIG_LAYOUTROOTPATH];
}
if (TRUE === isset($paths[self::CONFIG_PARTIALROOTPATH])) {
$partialRootPaths[] = $paths[self::CONFIG_PARTIALROOTPATH];
}
// translate all paths to absolute paths
$templateRootPaths = array_map(array($this, 'ensureAbsolutePath'), $templateRootPaths);
$layoutRootPaths = array_map(array($this, 'ensureAbsolutePath'), $layoutRootPaths);
Expand Down
6 changes: 3 additions & 3 deletions Tests/Unit/FormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,9 @@ public function supportsFormComponentsPlacedInPartialTemplates() {
$template = $this->getAbsoluteFixtureTemplatePathAndFilename(self::FIXTURE_TEMPLATE_USESPARTIAL);
$service = $this->createFluxServiceInstance();
$paths = array(
'templateRootPath' => 'EXT:flux/Tests/Fixtures/Templates/',
'partialRootPath' => 'EXT:flux/Tests/Fixtures/Partials/',
'layoutRootPath' => 'EXT:flux/Tests/Fixtures/Layouts/'
'templateRootPaths' => array('EXT:flux/Tests/Fixtures/Templates/'),
'partialRootPaths' => array('EXT:flux/Tests/Fixtures/Partials/'),
'layoutRootPaths' => array('EXT:flux/Tests/Fixtures/Layouts/')
);
$viewContext = new ViewContext($template);
$viewContext->setTemplatePaths(new TemplatePaths($paths));
Expand Down
6 changes: 3 additions & 3 deletions Tests/Unit/View/ExposedTemplateViewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,9 @@ protected function getPreparedViewWithTemplateFile($templatePathAndFilename) {
*/
protected function getFixtureTemplatePaths() {
$templatePaths = array(
'templateRootPath' => ExtensionManagementUtility::extPath('flux', 'Tests/Fixtures/Templates'),
'partialRootPath' => ExtensionManagementUtility::extPath('flux', 'Tests/Fixtures/Partials'),
'layoutRootPath' => ExtensionManagementUtility::extPath('flux', 'Resources/Private/Layouts')
'templateRootPaths' => array(ExtensionManagementUtility::extPath('flux', 'Tests/Fixtures/Templates')),
'partialRootPaths' => array(ExtensionManagementUtility::extPath('flux', 'Tests/Fixtures/Partials')),
'layoutRootPaths' => array(ExtensionManagementUtility::extPath('flux', 'Resources/Private/Layouts'))
);
return $templatePaths;
}
Expand Down
32 changes: 0 additions & 32 deletions Tests/Unit/View/TemplatePathsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,38 +52,6 @@ public function testFillByPackageName() {
$this->assertEquals(array(ExtensionManagementUtility::extPath('flux', 'Resources/Private/Partials/')), $instance->getPartialRootPaths());
}

/**
* @return void
*/
public function testFillByLegacyTypoScript() {
$instance = new TemplatePaths(array(
'templateRootPath' => 'EXT:flux/Resources/Private/Templates/',
'layoutRootPath' => 'EXT:flux/Resources/Private/Layouts/',
'partialRootPath' => 'EXT:flux/Resources/Private/Partials/'
));
$this->assertEquals(array(ExtensionManagementUtility::extPath('flux', 'Resources/Private/Templates/')), $instance->getTemplateRootPaths());
$this->assertEquals(array(ExtensionManagementUtility::extPath('flux', 'Resources/Private/Layouts/')), $instance->getLayoutRootPaths());
$this->assertEquals(array(ExtensionManagementUtility::extPath('flux', 'Resources/Private/Partials/')), $instance->getPartialRootPaths());
}

/**
* @return void
*/
public function testFillByLegacyTypoScriptWithOverlays() {
$instance = new TemplatePaths(array(
'overlays' => array(
'flux' => array(
'templateRootPath' => 'EXT:flux/Resources/Private/Templates/',
'layoutRootPath' => 'EXT:flux/Resources/Private/Layouts/',
'partialRootPath' => 'EXT:flux/Resources/Private/Partials/',
)
)
));
$this->assertEquals(array(ExtensionManagementUtility::extPath('flux', 'Resources/Private/Templates/')), $instance->getTemplateRootPaths());
$this->assertEquals(array(ExtensionManagementUtility::extPath('flux', 'Resources/Private/Layouts/')), $instance->getLayoutRootPaths());
$this->assertEquals(array(ExtensionManagementUtility::extPath('flux', 'Resources/Private/Partials/')), $instance->getPartialRootPaths());
}

/**
* @return void
*/
Expand Down

0 comments on commit 843f52f

Please sign in to comment.