How to get a plugin and flexform in typoscript? - typo3

Is it possible to get a plugin called with a flexform value?
temp.whatever = HTML
temp.whatever < plugin.tx_myplugin_pi1
Problem is i have a selectbox with two different templates to show:
$this->pi_getFFvalue($this->cObj->data['pi_flexform']
returns "Template1" or "Template2" for example

Related

How to get TCEFORM in a hook to read altLabels of a dropdown of another extension

I have a hook and try to get a dropdown label text of an other extension. How can i get the flexform typoscript with that values?
Get the TypoScript config with the BackendUtility and look in the TCEFORM of the desired extension:
$pageTs = \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig(1);
$typeLabels = $pageTs['TCEFORM.']['tx_news_domain_model_news.']['type.']['altLabels.'];

Reading data out of a flexform in typoscript

I try to read a flexform data out in typoscript. I tried it with several approaches, but none of them works correctly:
ajax.30 = TEXT
ajax.30.value = {$plugin.parser.settings.maxNumber}
ajax.40 < {$plugin.parser.settings.maxNumber}
ajax.50 < {$plugin.parser.settings.maxNumber}
ajax.60 = TEXT
ajax.60.data = {$field:flexform_varNum}
ajax.70 = TEXT
ajax.70.data = flexform : pi_flexform:settings.varNum
Can anyone give me a hint for the right syntax?
I'm using Typo3 9.5.13.
It is not possible to read out FlexForm data without an actual content element.
The CONTENT or COA objects would provide that. See for example Get FlexForm configuration in TypoScript
The feature was added in TYPO3 8.4 https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/8.4/Feature-17309-AccessFlexformValueViaTS.html

How can I pass one parameter or value from fluid to typoscript

I want to pass a value from my fluid code to typoscript. I have two variable (one is int, the other is some text) and I want to use those values in typoscript. Is that possible and if it is possible how?
I want to use the values to create opengraph tags in head of HTML.
Here's my TypoScript
lib.getuserItems = TEXT
lib.getuserItems.wrap = |
page.meta {
og:description < lib.getuserItems
og:description.attribute = property
og:locale = de_DE
og:locale.attribute = property
}
and here's my Fluid
<f:cObject typoscriptObjectPath="lib.getuserItems" data="{article.description}" />
Your problem will not be the parameter transfer.
If you use <f:cObject> in fluid you can compute something with typoscript which is returned and can be used to render the fluid template.
You want some data from your fluid-template transferred to the page configuration (page.meta....) which is not possible in this way.
If you want to set those meta tag data you can use viewhelper in fluid, but that must be PHP viewhelper, that can access page configuration and set these data.
Be aware that TYPO3 9LTS has introduced an API for metatags

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">');

typo3 extension two times on page, different setup?

I have written a Typo3 extension that I want to put 2 times on the same Typo3 page (actually in two parts defined through a templavoila template), but the two instances need different setups!
When I add content to the page through the "Page" module, I can add as many instances of my extension as I want. But in the "Template" module, there is only 1 configuration per page.
So my question is: what is the best way to have different typoscript setups for different instances of a single plugin on the same page?
Thanks for any hints!
If a configuration option is not available as flexform, or there are other reasons why to change the options via TypoScript, you may do it like this:
temp.tx_yourextension < plugin.tx_yourextension
plugin.tx_yourextension >
plugin.tx_yourextension = CASE
plugin.tx_yourextension {
# check for the uid of the content element (the plugin)
key.field = uid
# if nothing special is defined
default < temp.tx_yourextension
# the plugin with the uid 1234 needs different configuration
1234 < temp.tx_yourextension
1234 {
property = whatever
}
}
Instead of requesting the uid, you could check for section_frame or any other field.
But keep in mind, some extensions accessing directly the TypoScript via $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_yourextension.']['property'] which will prevent this option.
You could do the same on tt_content.list.*
# without tx_ prefix
temp.yourextension < tt_content.list.20.yourextension
tt_content.list.20.yourextension >
tt_content.list.20.yourextension = CASE
...
Why using template configuration? You could define some configurations for the frontend plugin itself (with flexforms), so every instance could be customized.
You can use the flexform to have different setups. Each flexform is stored in a separate database field.