Project

General

Profile

Actions

Bug #70684

closed

ExtensionManagementUtility::extPath returns different file paths

Added by Christopher Orth about 9 years ago. Updated almost 9 years ago.

Status:
Rejected
Priority:
Must have
Assignee:
-
Category:
-
Target version:
-
Start date:
2015-10-14
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
7
PHP Version:
5.5
Tags:
7.5
Complexity:
Is Regression:
No
Sprint Focus:

Description

Hi,

since TYPO3 7.5, \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(); returns different file paths.

Reproduce:
- Create a dummy extension including a valid TCA
- Edit TCA and add following in ext_tables.php:
$GLOBALS['TCA']['tx_dummy_domain_model_dummy'] = array(
'ctrl' => array(
'dynamicConfigFile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Configuration/TCA/Dummy.php',
'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($_EXTKEY) . 'Resources/Public/Icons/tx_dummy_domain_model_dummy.gif'
),
);

Go to the Backend, open "Configuration" check "$GLOBALS[TCA]" Array.
- iconfile will be: "../typo3conf/ext/dummy/Resources/Public/Icons/tx_dummy_domain_model_dummy.gif"
- dynamicConfigFile will be: "/var/www/public/typo3conf/ext/dummy/Configuration/TCA/Dummy.php"

Because of "iconfile" has to be prefixed with "EXT:" the iconfile will never been shown in the Backend List-View.
If you return the complete TCA array in "typo3conf/ext/dummy/Configuration/TCA/tx_dummy_domain_model_dummy.php" instead of set the ctrl array in ext_tables.php "extRelPath()" will return the correct prefixed file paths for both keys (dynamicConfigFile and iconfile)

Best,
Christopher

Actions #1

Updated by Zsolt Molnar about 9 years ago

you have used the \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath method for the 'dynamicConfigFile' but for the other one \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath, so extPath VS. extRelPath. It makes sense why you got two different return value.

Actions #2

Updated by Christopher Orth about 9 years ago

Hey,

I dont think it makes sense the same method returns sometimes absolute, sometimes relative paths but nevermind.

This isnt the main problem here. The problem is using extPath() in your ext_tables.php file will return a unprefixed wrong relative path since 7.5 (please see my example).
The icon cant be found with that path so your icon file cant be rendered in the TYPO3 Backend.

Unfortunately you need the "EXT:" prefixed file path for icons, or the correct unprefixed path. Neither is the case here. Using the same Method in "typo3conf/ext/dummy/Configuration/TCA/tx_dummy_domain_model_dummy.php" will return the correct prefixed path.

Best

EDIT:
You're absolutely right, i used different methods for "dynamicConfigFile" and "iconfile" in my example, bad one ;)
But it doesnt matter which method you use, the icon cant be found anymore.

Actions #3

Updated by Morton Jonuschat almost 9 years ago

  • Status changed from New to Rejected

As discussed in the comments the original report is the result of using different methods of ExtensionManagementUtility to get the paths.
While using relative paths for the iconfile is deprecated and results in an entry in the deprecation log it still works when used like this:

ExtensionManagementUtility::extRelPath('dummy').'Resources/Public/Icons/tx_dummy_atable.png'

As the TCA is being migrated and cached it is required to flush the system caches after a change in the TCA config to activate the changes.

Actions #4

Updated by taywa gmbh almost 9 years ago

in typo3 7.6 the suggested "solution" ExtensionManagementUtility::extRelPath('extensionname').'Resources/Public/Icons/dummy.gif' to migrate old extensions does not work anymore. i tried different approaches and what worked for me in the end was:

ext_tables.php

'iconfile'  => 'EXT:'.$_EXTKEY.'/icons/performance.gif',

Actions

Also available in: Atom PDF