Passing argument from one plugin to another - typo3

I have one extension that has 2 plugins. I would to pass an argument from plugin1 to plugin2.
In plugin1's view I generate a link to a page where a content element for plugin2 is inserted:
<f:link.action controller="ApplicationController" action="showFormAction" arguments="{test: 1}" pageUid="40">Link</f:link.action>
In ApplicationController I try to retrieve the test parameter like this:
$this->request->getArgument('test');
But I get this error:
#1176558158: An argument "test" does not exist for this request.
Is there a way to solve or debug this ?

You simply forgot to set pluginName="Plugin2Name" in your f:link.action viewhelper call. You can see that the link currently contains the desired argument but with the namespace of the 1st plugin. If you add pluginName, the namespace will be changed to the 2nd plugin.

Related

Can the ScalaTest checkbox function accept a CSS selector?

I’m using ScalaTest to write Selenium acceptance tests for a Play web app. I have a checkbox I want to check, using the checkbox function:
checkbox("cbx1").select()
As far as I can tell, it takes the name attribute of the <input> element to identify which checkbox I’m referring to. However, this checkbox is one of eight, and its name attribute is in the form fieldname[7]. I don’t have access to its index in my test, so I can’t generate the right name attribute value.
Is there a way to use the checkbox function with a CSS selector to identify which checkbox should be selected? I’ve tried passing a CSS selector straight to the function:
checkbox("""[name=^"fieldname"][value="TheCheckboxValue"]""").select()
But unsurprisingly, I get an error:
WebElement '[name^="fieldname"][value="TheCheckboxValue"]' not found.
Aha — this seems to work:
checkbox(cssSelector("""[name=^"fieldname"][value="TheCheckboxValue"]""")).select()

Get path of FAL media?

Using Fluid Template with tx_news, I need to get the URL of uploaded FAL video.
Currently I have this:
{newsItem.falMedia.0}
Which prints:
GeorgRinger\News\Domain\Model\FileReference:3
I want the output:
fileadmin/user_upload/MyVideo.mp4
newsItem.falMedia seems to be an ObjectStorage. With .0 you are pointing to the first object of it - not any function of it. In the API you can see its functions http://api.typo3.org/typo3cms/current/html/class_t_y_p_o3_1_1_c_m_s_1_1_core_1_1_resource_1_1_file_reference.html or you can debug it in Fluid by using {newsItem.falMedia.0}
Example: {newsItem.falMedia.0.publicUrl} should give you the public path to the file.
If you just need url of image than use following line
{object.image.originalResource.publicUrl}..
TYPO3: get path out of file reference in Extbase
Please refer above link.

Using the output of a partial as a variable in main template

Out of this question: Random image with v:iterator.random | cache issue
I use a partial to render non-cacheable stuff (in this case a random image).
I do this with this code in the main-template:
{v:render.uncache(partial: 'Random-Image', arguments: {iterator: images})}
Have this directly in the template outputs the right thing (the url to an image, for example fileadmin/upload/abc.jpg). But if I want to use this as a variable for the src from <f:image it does not work:
<f:image src="{v:render.uncache(partial: 'Random-Image', arguments: {iterator: images})}" alt="alt text" />
Also set as a variable it with v:variable.set does not work.
All I get is: <!--INT_SCRIPT.0081e57d9fd92c925bb35d79fd9d3f79-->
Also when I debug it:
<f:debug>
{v:render.uncache(partial: 'Random-Image', arguments: {iterator: images})}
</f:debug>
I get <!--INT_SCRIPT.0081e57d9fd92c925bb35d79fd9d3f79-->
So, is it possible to use the output of a partial as a variable? Or is it possible to set a variable in the partial and use it in the main-template?
I think you mixed up two things a bit, so I would like to separate your questions:
1) Is it possible to use the output of a partial as a variable?
Yes, like the way you wanted it. Actually you did it.
But let see a test:
There is a Partial : Test/Message
With the content: "It is a test"
Then in the main template you can use something like this:
<div class="test">
<f:if condition="{f:render(partial:'Test/Message')}
== 'It is a test'">
<f:then>Passed</f:then>
<f:else>Failed</f:else>
</f:if>
</div>
In this case you would see "Passed" and if you change the Partial to "It should failed" then you will get "Failed" rendered.
2) Why do you see <!--INT_SCRIPT.0081e57d9fd92c925bb35d79fd9d3f79--> ?
This is a not cached content, so like COA_INT or USR_INT objects in TypoScript.
You can find a function in the typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php its name is INTincScript_process. It is responsible to find such lines in the code and replace them with the not cached content.
It means, if you render your Template, that partial renders only a reference to a not cached object, but not the content itself.
Finally to suggest a solution to the original problem, try to render the whole image inside the partial not just the path to it. So include the into the partial where the v:iterate.random ViewHelper is used. Then the v:render.uncache should mark the whole image block as not cacheable.

TYPO3 extension: how to find certain TS setting

I found in typo3 admin side(/typo3), you can have two ways to set up TS,
you can set up through template->root, I think TS here will affect the whole site.
you can set up through template->certain page, it will only affect this page.
So my question is:
If I want to find where(which page) has TS setting such as : code = LIST, how could I do?
Use Web > Template module it has tools, you can for an example use Template Analyzer for the search
Try querying the database in phpMyAdmin or similar. The following looks in Template Setup:
SELECT pid, config, constants
FROM sys_template
WHERE config LIKE '%code = LIST%'
Replace config with constants to look in Template Constants. pid is the page ID.
If it is not set in the TypoScript, it perhaps has been set in the plugin itself. Just check the plugin content element itself.
In the Template module, go to the page where the setting is in effect.
Use the TSOB (Typo Script Object Browser) to search for "list":
This must show you all TS for this page that contains "list".
If you don't see the setting you can run a cmd/ctrl-F Search over the entire results.
You would have to search for "[code] = LIST".
Which will lead you to the following entry:
Hovering over the label will produce the above tooltip. Copy the line number.
Now change to the Template Analyzer. Here, you can click through all cascading templates and search for the line number:
This is definitely the line that sets that value.
From the "Template hierarchy" tree you will easily find the template that contains the setting.

dynamic value pass to applet based on dropdown value selection

I have to pass value dynamically to applet so that it can pick correct xml from resource based on the value selected from the dropdown .
<applet code="com.vaannila.utility.dynamicTreeApplet.class" archive="./appletjars/dynamictree.jar, ./appletjars/prefuse.jar" width ="1000" height="500" >
</applet>
How can i do that .
You can handle this by writing a public method in your applet
let's assume
void setXmlName(String xmlName);
you can access this method from java script .. for example this java script method
function updateXmlName(value){
/* Get an object of the applet .. make sure the at 'id' attribute has the 'myappletid' value. */
var myApplet = documents.applets["myappletid"];
myApplet.setXmlName(value);
}
update your dropbox HTML
<select id="optionList" onchange="updateXmlName(document.getElementById('optionList').value);>
I hope this could help you.
If you choose a value from dropdown and then send it to the page with applet then used simple <param> tag (as described here). If you want to do it dynamically, then you can invoke java methods via javascript as described here.