html tag print as string in Exceptionlocalization magento2 controller - magento2

In the magento2 controller when I tried to give link in adderrormassage exceptionlocalization it returned an anchor tag as the string below is the output->
Click Me

Related

Getting the page title from the new PageTitle

I'm looking for a way to get the page title set via the new PageTitleProvider API to display it inside a FluidTemplate.
In one of our TYPO3 installations, the page title is used as title, displayed on the page itself. The main PAGE object is set up to render a FLUIDTEMPLATE object. I've implemented the examples on the new PageTitleAPI in the documentation, https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/PageTitleApi/Index.html into my extensions and that works just fine for the tag.
However, within the page itself, the title set in the page is still displayed, not the title I've set in my extension.
I've figured out, that I can instantiate the PageTitleProviderManager, but getTitle still resolves to the page name, not the title I've set, most likely because this object is resolved before the PageTitleProviders are set up by the extensions.
$pageTitleProviderManager = GeneralUtility::makeInstance(\TYPO3\CMS\Core\PageTitle\PageTitleProviderManager::class);
\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump( $pageTitleProviderManager->getTitle() );
// -> outputs the page name, not the title custom page title
Is there a way to resolve the page title after all Providers are processed and display it in a fluid template?
I also assume it depends on order of execution. so you need to build an order where your plugin is executed before the page title is rendered in the page template.
nowadays most integrators use the f:cObject viewhelper to render the content with lib.content. that means the content (and your plugin is rendered very late), as the page title is probably rendered before any content in the page template (independend whether you use template variables from the page template or a viewhelper which executes PHP or typoscript in the moment of the rendering.
Here you get a hint how to change the order:
try to render the content (including plugins) into a fluid-variable with the page templating ( e.g.:
page.10 = FLUIDTEMPLATE
page.10.variables.content < styles.content.get
) and try to get the page title when the page fluid is rendered: use a viewhelper to get the page title when the initial FLUID variables are already computed.
of course you also can define a FLUID-variable for the content in the page FLUID template before accessing the page title by viewhelper:
<f:variable name="content"><f:cObject typoscriptObejctPath="lib.content" /></f:variable>

Get Page Name/ID of Content Element in Backend Edit View

I'm new to Typo3.
Inside the Configuration section of my own Content element I need the ID or name of the Content element's page. How would you implement that?
I already tried to use flux:field.input but I dont know what to do with typoscript.
record.pid was the thing I was looking for!
<f:debug>{record}</f:debug>

How can I avoid displaying the web-view-link IN the web view of TYPO3-ext newsletter?

I'm using TYPO3 newsletter extension and I'm looking for a solution not to display the link to the web view again when the web view already is shown.
newsletter is an extension that makes it possible to send pages as an email. If the users clicks on the link in the email, a browser window opens with a web view of the newsletter. I want to avoid the redundant display of this link.
In my newsletter fluid template i've got the following line:
###:IF: newsletter_view_url ###<p>If this e-mail cannot be display correctly, please click here.###:ENDIF:###</p>
The placeholders are delivered exclusively by the extension, so they are - as you see - no typoscript vars. The problem is: newsletter_view_url is always filled with a value and also the other possible vars always take the same value in email view as well as in web view.
What i tried so far:
Assign some var to the fluid template to distinct the web view from the email view:
# Create a Fluid Template
page.10 = FLUIDTEMPLATE
page.10 {
# Set the Template Paths
partialRootPath = {$privateTemplatePath}Partials/
layoutRootPath = {$privateTemplatePath}Layouts/
variables {
controllerAction = TEXT
controllerAction.data = GP:tx_newsletter_p|action
}
}
and in the fluid template file:
<f:if condition="{controllerAction}"><p>If this e-mail cannot be display correctly, please click here.</p></f:if>
Problem: controller action does not take any value though it is set in the get-string while opening the url from the newsletter:
test.html?type=1342671779&tx_newsletter_p%5Bc%5D=a0648d94a22dd5928762b1bd5f82e9de&tx_newsletter_p%5Baction%5D=show& ...
It also does not work if i use controller action for a typoscript condition
controllerAction = TEXT
controllerAction.value = 1
[globalVar = GP:tx_newsletter_p|action = show]
controllerAction.value = 0
[global]
I would be very grateful for further inspirations! Thank you so much!
According to this feature request, it is not implemented yet:
https://github.com/Ecodev/newsletter/issues/19
I suggest contacting author and submitting pull request with this change. As of how to implement it, might be changing the PHP code to add custom parameter to the URL when viewing in browser which would hide any part of newsletter template.

How can I pass an object to a specific view on a another page in TYPO3?

I have a simple controller with two actions:
listAction - shows a list of my objects
showAction - shows the detail page of an object
I am using a flexform for my plugin to define the detail page and can access to this via settings array in my controller. The standard view (list view) shows all my objects with a link to the detail page. This link will be generated by this fluid link action:
<f:link.action action="show" arguments="{example: example}" pageUid="{pageId}">details</f:link.action>
The generated links looks as follows:
details
I think that's ok and the redirect to the correct detail page is also working, but it seems that the show view is not showing up, because it will not be rendered. My showAction and my Show.html looks as follows:
Show.html
<f:layout name="Default" />
<f:section name="main">
<h1>Detail page</h1>
<f:debug>{example}</f:debug>
</f:section>
showAction:
/**
* Shows the details page
*
* #param \Fox\Example\Domain\Model\Example $example
* #return void
*/
public function showAction(\Fox\Example\Domain\Model\Example $example) {
$this->view->assign('example', $example);
}
So it seems that the action of the fluid link action viewhelper will be ignored. When I remove the pageUid="{pageId}" from the link action above I can see the show view, but then I will be not redirected to the correct detail page.
What am I doing wrong?
UPDATE
Ok it is working when I include the frontend Plug-In to the detail page, too. Is there a way to pass up the double include?
Ok it is working when I include the frontend Plug-In to the detail page, too. Is there a way to pass up the double include?
No, it is supposed to work like this - a plugin has to be present on a page if it should be rendered there. This presence can be indirect though:
You could reference the plugin (using a record of type "Include Records", or some reference mechanism from an extension).
You could include it using TypoScript (frequently used if it should
be on many pages).
Anyway, if there is no specific reason to have separate pages in the page tree for detail and list view, just put them on one page using the same plugin.

How to submit a form in a UIWebView loaded with HTMLString:baseURL:?

oHi,
I'm displaying a html page which contains a form with some input text fields and a submit button.
If i display the page using loadRequest: everything works fine.
If i display the same page using loadHTMLString:baseURL: the submit button is not working anymore.
The adress which is supposed to be called is :
http://..../lire.php?id=33570#bloc_commentaire
If i log the adress it tries to reach i got :
applewebdata://BF6F3D92-9F36-40CA-A3EB-BCD3F14852B6#bloc_commentaire
Do you have any idea of what i should do to be able to post a form loaded statically using loadHTMLString:baseURL: ?
Thanks,
Vincent
The problem occurs because your web view doesn't know where to post the data because the html is loaded from a string and not a specific web server.
Make sure you are setting baseURL correctly in your call to
[webView loadHTMLString:(NSString *)string baseURL:(NSURL *)baseURL]
Details:
When the webview finds a relative url in the html, it joins it with the baseURL to form an absolute url which can be used to submit or click on. For instance:
Given http://www.test.com/foo/ as baseURL and a relative url tag lke click me
When the user clicks on the link, the view will make a request to http://www.test.com/foo/bar/hello.php