How to add one plugin to multiple pages at once in typo3 and tell which action to use - plugins

I have a typo3 installation with one extension that has a plugin.
I want to add the plugin to one page via typoscript and all subpages in that page tree should have it as well.
I only find code fragments that use switchableControllerActions but this is deprecated, as far as I can see.
How can I tell the plugin in the page which action is the action to use?

These fragments handling switchableControllerActions can be ignored if you have already separated plugins in your extension.
lib.insertPlugin = USER
lib.insertPlugin {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
vendorName = myVendor
pluginName = MyPlugin
extensionName = MyExtension
settings =< plugin.tx_myExtension.settings
persistence =< plugin.tx_myExtension.persistence
view =< plugin.tx_myExtension.view
settings {
// ...
}
}
The plugin will use its default action (except, there is another action defined in the request, e.g. by submitting a form, following a link,...).
The first action in the action list of the first line of the configuration parameter is the default action of the plugin. (-> \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin())

Related

How to call a controller action on every page request

I have a Plugin with various actions, one of the Actions I would like to call every time a page is requested. I tried it this way but when I have the plugin on the same page (lets say it's a Contact form) Then the Plugin didn't know the other Actions, so I have to include every time all actions in the switchableControllerActions.
Is there maybe an another way? Maybe register the Action of the Controller in some kind of hook?
Probably you can create lib object of the extension, Take a look at below user function:
lib.myData = USER
lib.myData {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
extensionName = Ext
pluginName = pluginName
vendorName = MyVendor
switchableControllerActions {
MyController{
1 = myAct
}
}
settings < plugin.tx_ext.settings
settings {
// Your settings
}
}
Now, you can call the lib object to the fluid template (As you need for each page) you can add this object to the main page layout.
Here Georg Ringer has created same code to render news listing with Typoscript.
Hope this will help you!
OK I've recieved a hint and that's the Solution:
20 = USER_INT
20 {
userFunc = Vendor\Extension\UserFunc\Class->function
}
You can use FlexForms to set a preset Controller->Action. So even if you use a plugin twice on one page you can control the Controller->Action of each Plugin via FlexForm.
Maybe this helps a well:
Multiple controllers in an extension

Load specific style sheet for each frontend plugin - TYPO3 Extbase

Using TYPO3 version 8
I have a custom extension that contains three frontend plugins.
For each of the three plugins I have a separate stylesheet for each of them.
Currently, all three style sheets are loaded even if one of the plugins isn't loaded on that page.
My setup.ts:
page.includeCSS.tx_myextension_frontendpluginONE = EXT:myextension/Resources/Public/Css/frontendpluginONE.css
page.includeCSS.tx_myextension_frontendpluginTWO = EXT:myextension/Resources/Public/Css/frontendpluginTWO.css
page.includeCSS.tx_myextension_frontendpluginTHREE = EXT:myextension/Resources/Public/Css/frontendpluginTHREE.css
Question:
Using only Typoscript, can I load a stylesheet for each plugin and not have it load if the plugin is not displayed on the page? I assumed it would sit somewhere in my extension configuration:
plugin.tx_myextension_frontendpluginONE.settings {
Call it in here perhaps?
}
Thanks again.

TYPO3 7.6 TCEFORM Custom Layouts doesn't work

I upgraded TYPO3 6 to 7.6.x and now I can't choose custom layouts in the backend for any content elements in the backend. I only see the default options like "layout 1, layout 2". The reason is obviously that my TCEFORM addings doesn't work..
The following typoscript won't have any effect in a ext-template of a page or in the root setup.ts:
TCEFORM.tt_content.layout.altLabels.2 = Test
TCEFORM.tt_content.layout.removeItems = 2,3
TCEFORM.tt_content.layout.addItems.5 = New Item
I know the problem description is a bit inaccurate. But I don't see the relevant infos which u need. Can u give me an advice what I have to check? Are there known conflicts with extension like fluidcontent, css_styled_content or so?
TypoScript configuring the back end is (though TypoScript by syntax) often called TSConfig and can be added either in page records or via user settings but never in extension templates or similar.
Configuring TCEFORM is usually done in page properties. To add, open page properties of your root page (or the topmost page of the subtree you want to configure) and add your code there.
As in front-end TypoScript you can swap your code to external files.
You need to add this typoscript on Root Page in Page TSconfig.
Edit root page properties and add your typoscript in Resources tab in Page TSConfig section like below image, so it's work fine.

TYPO3 tags and image issue with EXT: News System KEY: news VER: 2.2.1

Hi All
I'm running:
EXT.KEY: news on TYPO3 v. 6.1 with FLUID/EXTBASE.
I have 2 issue's/question.
1 - News Tag's disappear, when using "tag list" in plugin.
I have added a "tag list" as element on my TYPO3 page, and its working fine, my problem is when i add another news plugin on another page, it's showing all the tag's from the two news plugin setup and I dont what to do that, so if i go to "Startingpoint" in Settings/plugin for the "Tag List" news-element and set it to the folder I save my newslist1 in, then all the tag's are disappeared, how can I set the "Tag list" so it's only show the tag's thats in the news from the folder "Newslist1"?
I have done this "startingpoint" with the list show and its working fine, if at news page 1 it show the news from folder "newslist1" and if on news page 2 it shows only the news/items from folder "portfolio".
2 - more images for a news.
Is it possible to add some image for the news text, so i have 2-3 images in the site, like when u add a normal text/image element?
Answer to issue 2
You can enable the use of normal content elements in News. The switch to activate that feature is in the Extension Manager configuration of News. You then have the possibility to add any content element to a News record.
By default the content elements are rendered before the normal news content, see here:
https://git.typo3.org/TYPO3v4/Extensions/news.git/blob/HEAD:/Resources/Private/Templates/News/Detail.html#l67
Of course you can change to order if you copy the template and adjust it to your needs.
Its beter add you plugin width ts, like
lib.newstags = USER
lib.newstags{
userFunc = tx_extbase_core_bootstrap->run
extensionName = News
pluginName = Pi1
switchableControllerActions {
Tag {
1 = list
}
}
settings < plugin.tx_news.settings
settings {
listPid = 73 # here you tagse source page/folder
}
}
Its beter to use Type "Innernal link". You can select in item edit form. Than you can add any page like contents element in your news item.

How to make TSConfig work in TYPO3 tx_news

In TYPO3 6.1, how do I get the tsconfig for the tx_news news extension to work?
I try to add selectable layouts to news items:
tx_news.templateLayouts {
1 = A custom layout
99 = LLL:fileadmin/somelocallang/locallang.xml:someTranslation
}
This should add the new Layout to the Type field, as in:
or did I get that wrong? Where can that new custom layout be selected?
Also, I'm trying to prefill fields in flexforms (when a new plugin is inserted):
TCEFORM.tt_content.pi_flexform.tx_news.sDEF.categoryConjunction = and
But it does not work yet.
How can this be done?
With tx_news.templateLayouts you override the flexform for the news plugin you insert on a page, not for a news record.
Your second code looks almost right, but you forgot settings: TCEFORM.tt_content.pi_flexform.tx_news.sDEF.settings.categoryConjunction = and
And even though this code is right, it will not work because of a bug with flexform fields that have a dot in their name (this is just stupid).
I think the only way to cleanly modify the flexform, is to write a small extension which overrides the default news flexform.