TYPO3 addToolbarItem (BE extension) - typo3

Hey guys and Happy Easter,
I am working on an extension for the backend and would like to have the standard toolbar with save and cancel options in my own extension.
So I would like to have sth. like this:
I am kind of an newbie and would like to have a little more detailed answer.
Found something about addToolbarItem on the internet but don't know how to use it.
Edit:
Unfortunately I have to work with TYPO3 v4.5 and pibase extension and don't have enough time to change the version to 6.2.9...
Thanks!

Assuming you're using TYPO 6.x+ and Extbase!
You can put additional elements from your view to the layout by additional sections. most probably your view now looks like:
<f:layout name="Default"/>
<f:section name="content">
<h1>Foo</h1>
</f:section>
so add new section i.e.:
<f:layout name="Default"/>
<f:section name="myButtons">
<f:be.buttons.icon icon="actions-document-new" title="Create new Foo" />
</f:section>
<f:section name="content">
<h1>Foo</h1>
</f:section>
And finally in your Default.html layout render your section in proper place (set it as optional, otherwise you'll get an exception if missing!)
....
<div class="typo3-docheader-buttons">
<div class="left">
<f:render section="myButtons" optional="true"/>
</div>
<div class="right">
<span title="Reload" class="t3-icon t3-icon-actions t3-icon-actions-system t3-icon-system-refresh"> </span>
<f:be.buttons.shortcut />
</div>
</div>
....
Of course this way you can also set other elements like <f:be.menus.actionMenu>, <f:be.pageInfo /> etc, or even just your text labels.
Check ViewHelpers in typo3/sysext/fluid/Classes/ViewHelpers/Be/ for some ready to use elements.

Related

TYPO3 8.7 - how to hide elements in navigation header before login with EXT:felogin?

I can't find a solution for a problem I have with a TYPO3 Fluid template.
In the navigation header template I have a search form and a logout link.
<div class="suche">
<f:form action="search" method="post" controller="Search" extensionName="indexedsearch" pageUid="61" pluginName="Pi2">
<f:form.textfield name="search[sword]" value="{sword}" class="quicksearch-sword" placeholder="search" />
<button type="submit" name="search[submitButton]" class="btn">
<i class="glyphicon glyphicon-search"></i>
</button>
</f:form>
<p>
<div class="logout">
<f:link.page pageUid="1" additionalParams="{logintype:'logout'}">Logout</f:link.page>
</div>
</p>
</div>
How can I tell the page, that these two elements should also hide till the user is logged in with EXT:felogin?
The template is included into the default page template in this way:
<f:render partial="Navigation/Main" arguments="{_all}" />
I guess a simple display:none/show from the two divs would be enough, but I have no idea how to do this. (I must admit I'm not the biggest expert in TypoScript).
Any advice would be really helpful and appreciated.
You can use the <f:security.ifAuthenticated> view helper.
More you can see here:
https://docs.typo3.org/other/typo3/view-helper-reference/8.7/en-us/typo3/fluid/TYPO3_8-7/Security/IfAuthenticated.html
Example:
<f:security.ifAuthenticated>
<f:then>
shown when a user logged in
</f:then>
<f:else>
shown when a user is not logged in
</f:else>
</f:security.ifAuthenticated>

Typo3 Content Elements not visible in own Fluid Template

I started to create my own Typo3 extension which is based on FluidTemplating. I created Layouts, Templates and Custom Content Elements. The site works fine regarding showing the template. I am also able to see the backend grid for the content elements. But when I add new Content Elements (no matter if Typo3 predefined ones or the ones from my extension), the placeholder within the template does not get replaced with the specific content.
I defined the grid in the Page-Template as follows:
<f:section name="Configuration">
<flux:form id="frontpage">
<!-- Insert fields, sheets, grid, form section objects etc. here, in this flux:form tag -->
</flux:form>
<flux:grid>
<!-- Edit this grid to change the "backend layout" structure -->
<flux:grid.row>
<flux:grid.column colPos="0" colspan="12" name="main" />
</flux:grid.row>
<flux:grid.row>
<flux:grid.column colPos="1" colspan="4" name="footerleft" label="Footer Left" />
<flux:grid.column colPos="2" colspan="4" name="footermiddle" label="Footer Middle" />
<flux:grid.column colPos="3" colspan="4" name="footerright" label="Footer Right" />
</flux:grid.row>
</flux:grid>
</f:section>
And add them into the sections like this:
<f:section name="Main">
<div class="section">
<v:content.render column="0" />
</div>
</f:section>
<f:section name="Footer">
<div class="footer">
<v:content.render column="1" />
<v:content.render column="2" />
<v:content.render column="3" />
</div>
</f:section>
Has anyone some ideas/suggestions/experience? What could be the problem here or how I am able to debug the problem?
Thanks a lot in advance.
Including the template if you haven't done so:
Here is an example:
typo3 styles.content.get not working

fluidcontent as container does not render

I'm trying to setup a small Website based von TYPO3 6.2 with flux and fluid Templating Engine.
I use:
fluid: 6.2
flux: 7.2.1
fluidpages 3.2.3
fluidcontent 4.2.2
fluidcontent_core: 1.1.3
vhs: 2.3.3
builder: 0.18.0
I have used the builder for a provider extension and I have managed to make page templates and also content templates.
But when I try to use a content element as content container it will not be rendered.
I have read similar articles here and also the documentation but I can't find a solution.
The static TS of fluidcontent_core is included.
I have also copied the line
$GLOBALS['TYPO3_CONF_VARS']['FE']['contentRenderingTemplates'] = array('fluidcontentcore/Configuration/TypoScript/');
in AdditionalConfiguration.
Following is my minimal Conatinertemplate:
div xmlns="http://www.w3.org/1999/xhtml" lang="en"
xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers"
xmlns:v="http://typo3.org/ns/FluidTYPO3/Vhs/ViewHelpers"
xmlns:flux="http://typo3.org/ns/FluidTYPO3/Flux/ViewHelpers">
<f:layout name="Content" />
<f:section name="Configuration">
<flux:form id="btContainer" label="UpContainer" options="{group: 'stth'}">
</flux:form>
<flux:grid>
<flux:grid.row>
<flux:grid.column name="Col2" label="Inhalte" />
</flux:grid.row>
</flux:grid>
</f:section>
<f:section name="Preview">
<!-- If you wish, place custom backend preview content here -->
</f:section>
<f:section name="Main">
<div class="container addedClass">
<f:comment><flux:content.render area="Col2" /></f:comment>
<v:content.render column="Col2" />
</div>
</f:section>
I have tried to render content with v:content.render or flux:content.render but there is no output.
I get only an empty
<div class="container addedclass"> </div>
In the Backend I see the Container, labeled "Inhalte" and I can add Content. (Content is Standard CE like Text or header)
Can someone please give me a hint, what I can do next.
Thank you in advance
st
Update 1.7.2015
I have set up a new TYPO3 6.2 und used the preconfigured 'site kickstarter'.
As I added the AdditionalConfiguration.php I saw there where 2 lines to copy:
// fluidcontent_core
$GLOBALS['TYPO3_CONF_VARS']['FE']['contentRenderingTemplates'] = array('fluidcontentcore/Configuration/TypoScript/');
$GLOBALS['TYPO3_CONF_VARS']['FE']['activateContentAdapter'] = 0;
The second one is new to me.
Then I copied my Container-template in the my Provider extension: and YES - it works.
I tried to use the second line of AdditionalConfiguration in my original TYPO3 instance -- but there it does not work. So I am not shure if this was the solution. Perhaps someone has more insight?
Again: Thank you for your help.
I have seen some mistake in your code:
Your <flux:grid> code is outside of <flux:form> It should be inside. Please check entire code below:
<div xmlns="http://www.w3.org/1999/xhtml"
xmlns:flux="http://fedext.net/ns/flux/ViewHelpers"
xmlns:v="http://fedext.net/ns/vhs/ViewHelpers"
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers">
<f:layout name="Content" />
<f:section name="Configuration">
<flux:form id="btContainer" label="UpContainer" options="{group: 'Custom elements'}">
<flux:grid>
<flux:grid.row>
<flux:grid.column name="Col2" style="width: 100%" label="Inhalte" ></flux:grid.column>
</flux:grid.row>
</flux:grid>
</flux:form>
</f:section>
<f:section name="Preview">
<flux:widget.grid />
</f:section>
<f:section name="Main">
<div class="container addedClass">
<flux:content.render render="1" area="Col2" />
</div>
</f:section>
</div>

Adding an external image to a custom GWT cell

I'm working on a custom cell for a cell list that displays product information including an image and several text fields, similar to the one in the CellList sample. The images are not resources that are packaged with my app, they are on an external image server. I'd like to use UiBinder for the layout of the cell. Eventually the cell will be more complicated, but for now here is a my template that just shows a product description and image:
<ui:UiBinder
xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
<ui:style>
</ui:style>
<ui:with field="imageSource" type="java.lang.String"/>
<ui:with field="product" type="com.mydomain.ProductProxy" />
<div ui:field="root">
<span><ui:text from="{product.getDescription}" /></span>
<ui:image url="{imageSource}" />
</div>
The CellList displays a list of descriptions but no products. If I inspect the element with Chrome I can see that the ui:image is not being compiled into an img element:
<div onclick="" __idx="0" class="GPROKKBAB" style="outline:none;" tabindex="0">
<div gwtuirendered="gwt-uid-17">
<span>E03351 </span>
<ui:image url="http://images.mydomain.com/image/product_id.jpg"></ui:image> </div></div>
Any suggestions? I'm sure it's something obvious but I've been at it for a while and I've tried a number of things with no luck.
How about simply using an HTML img?
<img src="{imageSource}" />

Trying to get UIBinder to give me a span not a div

I am building a widget with UiBinder, and I need to have it enclosed in a <span /> but UiBinder only gives me <div />. E.g. <g:HTMLPanel /> => <div />. HorizonPanel, FlowPanel, VerticalPanel also give out only <div />.
Does any one know a solution?
Try this:
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui'>
<g:HTMLPanel tag="span">
<!-- your stuff -->
</g:HTMLPanel>
</ui:UiBinder>
You can keep using a <div> but just add display: inline to its CSS, which will make it display as though it were a <span>.
Edit: fixed place at the end where I said 'div' but meant 'span'.
With regards to the answer above by Robert (sorry I can't figure out how to comment that directly)
This won't work out of the box, as widgets can't be placed inside plain HTML (the compiler will give you "error: found widget in html context"). But there's a simple workaround:
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui'>
<g:HTMLPanel>
<span>
<!-- Your content with widgets goes here -->
</span>
</g:HTMLPanel>
</ui:UiBinder>
One other useful thing to mention is InlineHTML and InlineLabel widgets capable of holding arbitary html or plain text respectively in a <span>