tx_news and roq_newsevent: integrate plugin via TypoScript - typo3

I am upgrading tt_news + mbl_newsevent to their successors tx_news + (probably) roq_newsevent.
I am still missing out on how to access roq_newsevent data in a template when integrating (trying to) it via TypoScript.
Another community member has asked the same question on TYPO3 forge https://forge.typo3.org/issues/61060 before, but no answer.
I would expect it's just extbase basics, I haven't seen a plugin that can only be used via flexform, is it?
EDIT (returns no news):
temp.newslist = USER
temp.newslist {
userFunc = tx_extbase_core_bootstrap->run
extensionName = News
pluginName = Pi1
switchableControllerActions {
News {
1 = eventList
}
}
settings < plugin.tx_news.settings
settings.startingpoint = {$pidRecords}
settings.recursive = 1
settings.detailPid = {$pidDetail}
view =< plugin.tx_news.view
}

Related

typoscript call php function and print result

I want to call a simple PHP script with typoscript to print the results of it.
I tried this,
lib.doSomething = USER
lib.doSomething {
userFunc = fileadmin/pcoShowBlog.inc.php
}
page.20.marks.kumulierterInhalt < lib.doSomething
What is wrong in this case?
Update
also tried this:
lib.obj = USER
lib.obj.includeLibs = fileadmin/pcoShowBlog.inc.php
lib.obj.userFunc = Blog->showBlog
page.20.marks.kumulierterInhalt < lib.obj
and this:
page.10 = USER_INT
page.10 {
userFunc = In2code\MyUserFuncs\Blog->showBlog
}
page.20.marks.kumulierterInhalt = page.10.userFunc
You should not have any PHP files in fileadmin (security)!
Use an own extension and give the class and method name to the userFunc.
lib.doSomething.userFunc = Vendor\ExtensionName\UserFunc\ShowBlog->methodName
I work on TYPO3 10.4
I wanted to run function from my controller before frontend login, so I created my plugin and put it above felogin plugin.
For call function from my controller I use typoscipt like this:
lib.doSomething = USER
lib.doSomething {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
extensionName = extName
vendorName = vendor
pluginName = plugin
}
In template I just put
<f:cObject typoscriptObjectPath="lib.doSomething"/>
Problem can appears with more then one function in controller, because switchableControllerActions is deprecated, I suggest this solution: https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/10.3/Deprecation-89463-SwitchableControllerActions.html

How can I correctly instantiate tx_news by Typoscript

I need to create a instance of tx_news via Typoscript, but when I set startingpoint or limit settings, the plugin is not show in frontend; without these options it dislpays all storage news.
I have followed documentation in https://docs.typo3.org/typo3cms/extensions/news/AdministratorManual/BestPractice/IntegrationWithTypoScript/Index.html#add-news-by-typoscript and other pages. I am using TYPO3 8.7 and PHP 7.1
#Remove content in section
page.10.variables.noticiasGNFA >
lib.news = USER
lib.news {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
extensionName = News
pluginName = Pi1
vendorName = GeorgRinger
switchableControllerActions {
News {
1 = list
}
}
settings < plugin.tx_news.settings
settings {
detailPid = 515
overrideFlexformSettingsIfEmpty := addToList(detailPid)
orderBy = datetime
listPid = 151
backPid = 151
disableOverrideDemand = true
templateLayout = 4
#startingpoint = 318
#limit =3
}
}
#Set new tx_news plugin in section
page.10.variables.noticiasGNFA < lib.news
When the comment of any options with hashtag is removed, it does not work. Not display, not show some exception.
If you are using a Fluid template, you can use the <f:cObject typoscriptObjectPath="lib.news"/> anywhere.
Hope it helps.

TYPO3 - tx_news - Show related articles on detail page except current article

On the detail page of a tx_news record I also provide 'related articles' of the current article/record ... with the below snippet. But in the suggested 'related articles' the current record is also provided. How can I exclude the current article from the suggested list?
Typoscript:
lib.relatedByFirstCategory.articles = USER
lib.relatedByFirstCategory.articles {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
extensionName = News
pluginName = Pi1
vendorName = GeorgRinger
switchableControllerActions {
News {
1 = list
}
}
settings < plugin.tx_news.settings
settings {
#relatedView = 1
detailPid = 97
useStdWrap := addToList(categories)
categories.current = 1
categoryConjunction = or
overrideFlexformSettingsIfEmpty := addToList(detailPid)
startingpoint = 96
templateLayout = 4
hidePagination = 1
# added
excludeAlreadyDisplayedNews =1
}
}
News Detail.html
<!-- related articles -->
<f:if condition="{newsItem.firstCategory}">
<f:cObject typoscriptObjectPath="lib.relatedByFirstCategory.articles">{newsItem.firstCategory.uid}</f:cObject>
</f:if>
</f:if>
Source: https://docs.typo3.org/typo3cms/extensions/news/stable/singlehtml/Index.html#show-news-items-with-same-category-in-detail-html
excludeAlreadyDisplayedNews is your friend. Look here: https://docs.typo3.org/typo3cms/extensions/news/stable/singlehtml/Index.html#excludealreadydisplayednews

TYPO3 typeNum arguments

I want to make a link from a template to a pageType, made for iCal download:
<f:link.action pageType="730" arguments="{event: event}" target="_blank" title="bla">iCal Download</f:link.action>
In typoscript
tx_myext_icalendar = PAGE
tx_myext_icalendar {
typeNum = 730
config {
disableAllHeaderCode = 1
xhtml_cleaning = none
admPanel = 0
metaCharset = utf-8
additionalHeaders = Content-Type:text/calendar;charset=utf-8
disablePrefixComment = 1
}
10 = USER
10 {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
vendorName = Me
extensionName = SiteMe
pluginName = Events
switchableControllerActions {
Icalevent {
1 = iCalendar
}
}
}
}
In my iCalendarAction in the IcalleventController I never receive the arguments. No matter what I type there, not by parameter, neither by $this->request->getArguments()
I guess I need to adjust the typoscript. Any help would be welcome.
Thanks for your comments. Indeed the extensionname, pluginname, action, controller were needed in the link.action.
The thing is that the config extension which holds this, uses a custom extension that defines things like custom content elements. (I did not create this, so I got confused by it). Therefore the generated link was not the same (for extensionname, pluginname, action and controller) as defined in the pagetype. By explicitly defining them in the html template (link action), any argument is now received in the ical template.

How can I access the content variable from within Extbase extension when called by postuserfunc?

As dokumented in api.typo3.org the content parameter of Bootstrap->run is not used.
I need a way to process exactly this content within an extbase extension.
The extension is called by:
page = PAGE
page {
stdWrap {
htmlSpecialChars = 0
postUserFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
postUserFunc {
extensionName = MyExtension
pluginName = Pi1
controller = Firstcontroller
vendorName = MyCompany
action = list
}
}
......
How can I access the (postuserfunc-)content?
I tried to use the ContentObject, but couldn't find the content anywhere.
$this->configurationManager->getContentObject()
Is there a workaround?
Cheers
Wirsing
I'm assuming you want to get at the cObject record? You're almost there:
$contentRecord = $this->configurationManager->getContentObject()->data;