Change label of flexform select item in TYPO3 extension tx_news - typo3

I want to add a new sorting option to the flexform in the frontend plugin of the TYPO3 extension tx_news. This works fine so far with these additions:
ext_tables.php of my theme extension:
$TYPO3_CONF_VARS['EXT']['news']['orderByNews'] .= ',archive';
TypoScript configuration within my theme extension:
plugin.tx_news.settings.orderByAllowed := addToList(archive)
What I miss now is the possibility to change the label of the new item archive in the select field Sort by of the flexform.
I assume it is done via page TSconfig and TCEFORM.tt_content.pi_flexform.news_pi1.sDEF.settings.orderBy but I can't figure out exactly how.
TYPO3 version is 6.2

This did the trick for me:
TCEFORM.tt_content.pi_flexform.news_pi1.sDEF.settings\.orderBy.altLabels.archive = LLL:EXT:my_theme/pathto.xlf:archive
It's important to escape the dot before the fieldname!

I never tried to use pageTS to localize (only template TS), so I don't know if it is actually possible. I would however suggest localizing the label using the locallang files, in this case creating locallang_db.xlf in appropriate path in typo3conf/l10n/ with localization for tx_news_domain_model_news.archive label.
More info here: https://wiki.typo3.org/Translations#Translation_internals.2C_how_does_it_work.3F

Related

How to disable the translate option of content in TYPO3 8.7 translation wizard?

In TYPO3 8.7 you can choose whether you want to translate or copy content elements. How can I disable the "translate" option in the first step of the wizard?
In a current project the customer prefers to have only the copy possibility.
The Core itself supports this starting with version 9, so there is currently no core-wise solution in 8.x.
But: You may write an extension supporting the same configuration parameters as v9 does by XClassing PageLayoutView.php. Please see the change that introduces the possibility to configure these buttons.
Thx to the hint from Andreas Fernandez I was able to backport the feature from TYPO3 9.x to 8.7.x by xclassing the method.
I've put everything together into a Gist:
https://gist.github.com/peterkraume/1c0feb30440449ba1c708aa5ea8d7991
I am just using a css-based solution.
Just add the following to "ext_tables.php"
// Custom Backend CSS
$GLOBALS['TBE_STYLES']['skins']['base'] = [
'name' => 'cytrus Base Backend Skin',
'stylesheetDirectories' => ['EXT:myext/Resources/Public/Backend/']
];
And then create a file "mycss.css" in "EXT:myext/Resources/Public/Backend/" with the following content:
[data-slide="localize-choose-action"] > div > div:first-child {display: none;}
that's it!
this is the result

Order of Constants TS in Template Analyzer

i'm struggeling with the order of typoscript in constants. I've a provider extension holding all the templates and files for the site. Typoscript ist used in external files, i don't want to store typoscript in the database. I use typo3_forum ext and want to modify the templates to customize it. But when i put the ts for the view like:
plugin.tx_typo3forum {
view {
templateRootPath = EXT:provider/Resources/Private/Templates/Forum/Standard/
partialRootPath = EXT:provider/Resources/Private/Partials/Forum/Standard/
layoutRootPath = EXT:provider/Resources/Private/Layouts/Forum/Standard/
}
}
these values will be overwritten by the typo3_forum ext itself, cause the constants of typo3_forum ext stands in the templateAnalyser hirachy under my provider extension.
Sure storing the above ts in the constants field of my roottemplate solves the problem but is there no solution for external fiels to sort?
I've tried:
plugin.tx_typo3forum.view.templateRootPaths.100 = EXT:provider/Resources/Private/Templates/Forum/Standard/
but this doens't work, the ext uses the default template in that case.
Thanks for your help!
Cheers Mark
Put your line
plugin.tx_typo3forum.view.templateRootPaths.100 = EXT:provider/Resources/Private/Templates/Forum/Standard/
in the setup, not in constants.
You can move the path to constants like
Constants:
plugin.tx_typo3forum.view.myTemplateRootPath = EXT:provider/Resources/Private/Templates/Forum/Standard/
Setup:
plugin.tx_typo3forum.view.templateRootPaths.100 = {$plugin.tx_typo3forum.view.myTemplateRootPath}
If using TYPO3 version 8, take a look at https://forge.typo3.org/issues/75862. There is a bug regarding the fallback for template paths. The issue has been solved already and is targeted for version 8.4
The order of TS appearing in the template analyser simply reflects the order in which the files are loaded.
If you are already using a provider extension for your TypoScript and don't put any TS statements in the database (which is a good practice) you can go one step further and put no extension TS in the database at all (not even include static templates in the template record).
Just include the TypoScript files that you need in your provider extension with <INCLUDE_TYPOSCRIPT and you have complete control of the order of things.
In the database you have to put just one line in constants and one in setup, each of the including from your provider extension. This will also make you less dependent of the database because if you include a new file it is just loaded and no actions are needed in the actual template record in the backend.

Manage hierarchy / enforce priority of TS-templates

Well, there is actually another guy with exact the same problem. But until today, they didn't come up with a solution, that's why I'm asking it once again.
My entire TS is included by an extension in TYPO3 7.6.8. This works fine except with indexed_search. The TS inside my resources EXT get overwritten by the indexed_search default TS.
This is the order of the TS inside the Template-Analyzer:
SYS: TYPO3_CONF_VARS:FE:defaultTypoScript
EXT:fluid_styled_content/Configuration/TypoScript/...
... a bunch of other third party extensions ...
EXT:indexed_search/Configuration/TypoScript
EXT:templates_ext/Resources/Private/TypoScript
extbase
fluid
extensionmanager
belog
beuser
felogin
indexed_search
sys_note
realurl
So #7 is the extension which includes all my TS but it gets overwritten by #14. The only way to configure the indexed_search is inside the setup of the page template (which comes after all those above). But I want to avoid that to keep things clean.
Is there a way to prioritize a certain TS so that it doesn't get overwritten?
Open the TypoScript record, switch to the tab "Includes", at the bottom you will find the field Static Template Files from TYPO3 Extensions:. Select the value Include before all static templates if root flag is set.
Try putting the TS from your template extension inside the root page Setup field like this (adjust the path if necessary, your example says Resources/Private/TypoScript?):
<INCLUDE_TYPOSCRIPT: source="FILE:EXT:templates_ext/Configuration/TypoScript/setup.ts">
This should make sure that it is included AFTER all the other includes (I assume you included those via the includes tab?)

How to rename subheader in TYPO3 CMS backend

How can I rename a TYPO3 CMS backend field for authors? i.e. the mentioned field for content-elements of csc_styled_content?
In general, overriding label names can by done with Page TSconfig in the backend. The following example modifies the label of the subheader field.
TCEFORM {
tt_content {
subheader.label = My new Label-Name
}
}
There are two way to configure that adjustment in TYPO3.
Type your configuration changes directly to the page settings » resources » TypoScript Configuration » Page TSConfig (see the screenshot below)
as an alternative you can store that configuration directly in the file system - either in your custom extension (e.g. at typo3conf/ext/my_extension/Configuration/TSconfig/labels.t3s) or with a similar name in the global file storage (e.g. fileadmin/templates/configuration/...)
That's basically it to provide custom labels for any database table in the TYPO3 backend. Find more aspects that can be adjusted in the accordant Page TSconfig documentation.
If you want to rename a field of an extension like tx_news you could do it this way.
TCEFORM {
tx_news_domain_model_news {
title.label = Your New Label
}
}
Now there are two ways to get this to work:
Put it in Page TSConfig of the page settings
OR
Load it with your extension from a file (e.g. EXT:my_extension/Configuration/pageTSConfig.typoscript). For that you have to import this script by EXT:my_extension/ext_localconf.php!
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(
'<INCLUDE_TYPOSCRIPT: source="FILE:EXT:my_extrension/Configuration/pageTSConfig.typoscript">');

Extbase storagePid with levelfield

I try to set the the storagePid of an extbase plugin by using levelfield like this:
plugin.tx_myext.persistence.storagePid = TEXT
plugin.tx_myext.persistence.storagePid.data= levelfield: -1, storage_pid, slide
Using the storage_pid of the current page is no problem:
plugin.tx_myext.persistence.storagePid = TEXT
plugin.tx_myext.persistence.storagePid.data= page:storage_pid
But I want to use levelfield to improve the usability of an extension. Thus you only would have to setup the storage_pid in the root page and include the default typoscript setup for the extension, which uses levelfield, into the root template...
Does anybody have a clue why levelfield is here not working?
Not all fields can be used by default with levelfield. The fields that can be used on scratch are defined in $TYPO3_CONF_VARS["FE"]["addRootLineFields"]
To add another field simply add
$GLOBALS["TYPO3_CONF_VARS"]["FE"]["addRootLineFields"] .= ",storage_pid";
in typo3conf/ext_tables.php or in the ext_tables.php of your extension.