TYPO3 10.4: Menu of subpages with image - typo3

I would like to expand the content element "menu of subpages" with images from page resources.
In TYPO3 8.7 the following code did everything i needed:
<f:if condition="{menu}">
<ul class="pagemenu-img">
<f:for each="{menu}" as="page">
<li>
<a href="{page.link}"{f:if(condition: page.target, then: ' target="{page.target}"')} title="{page.title}">
<f:image src="fileadmin/{page.files.0.originalFile.identifier}" />
<span>{page.title}</span>
</a>
</li>
</f:for>
</ul>
</f:if>
With TYPO3 10.4 this isn't working anymore.
Is there another way? Preferably without using VHS.

It's still working.
I have tested your HTML-Template and the result is as expected:
Your problems seem to be something other...

Maybe there were some pages which didn't have any images with them...
You should therefore check if there is an image present:
[and get rid of the hardcoded fileadmin/ link there by< just using {page.files.0.originalFile}]
<f:if condition="{menu}">
<ul class="pagemenu-img">
<f:for each="{menu}" as="page">
<li>
<a href="{page.link}"{f:if(condition: page.target, then: ' target="{page.target}"')} title="{page.title}">
<f:if condition="{page.files.0}">
<f:image image="{page.files.0.originalFile}" />
</f:if>
<span>{page.title}</span>
</a>
</li>
</f:for>
</ul>
</f:if>

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>

How can I overlay the List plugin in RTE

By default AEM add some class as below when I use the ordered list in the RTE.
<ul style="list-style-position: inside;">
<li>Item 1</li>
<li>Item 2</li>
</ul>
I want to change to
<ul class="some class">
<li><font style='some font'>Item 1 </font> </li>
<li><font style='some font'>Item 2 </font> </li>
</ul>
So, for this I looked at the existing implementation here :
/libs/clientlibs/granite/richtext/core/js/plugins/ListPlugin.js/
But I do not understand how AEM is applying default class and where I need to make change.
This happens if you're working on AEM 6.3.
Check on your AEM instance the following lib:
/libs/clientlibs/granite/richtext/core/js/ListUtils.js
check for the following code:
com.addInlineStyles(listDom, {'list-style-position': 'inside'});

Dropdown Sidebar Menu Items in Laravel Backpack

In the Laravel Backpack docs they show an image that appears to have dropdown menus for the sidebar navigation menu, but I can't find anywhere that says how to use them. Is there a built in way or do I have to write my own styles?
In resources/views/vendor/backpack/base/inc/sidebar.blade.php you can add your own menu-items. Using .treeview and .treeview-menu you can make those items expandable:
See also the source code of that image.
<li class="treeview">
<i class="fa fa-key"></i> <span>Roles & Permissions</span> <i class="fa fa-angle-left pull-right"></i>
<ul class="treeview-menu">
<li>
<span>Roles</span>
</li>
<li>
<span>Permissions</span>
</li>
</ul>
</li>
As Oscar Torres pointed out, the new demo source for a nested menu lives here.
Backpack now uses Bootstrap's nav-dropdown class(es) to achieve these results:
<li class="nav-item nav-dropdown">
<a class="nav-link nav-dropdown-toggle" href="#"><i class="nav-icon la la-group"></i> Authentication</a>
<ul class="nav-dropdown-items">
<li class="nav-item"><a class="nav-link" href="{{ backpack_url('user') }}"><i class="nav-icon la la-user"></i> <span>Users</span></a></li>
<li class="nav-item"><a class="nav-link" href="{{ backpack_url('role') }}"><i class="nav-icon la la-group"></i> <span>Roles</span></a></li>
<li class="nav-item"><a class="nav-link" href="{{ backpack_url('permission') }}"><i class="nav-icon la la-key"></i> <span>Permissions</span></a></li>
</ul>
</li>

Set Category title as header in list view (TYPO3 tx_news)

I want to add the category title to the list view element, that the category menu sends you to. I'm just not figuring it out...
Here is my code in the fluid template:
Templates/News/List.html
<div class="news-list-view">
<f:if condition="{categories.0.headline}">
<f:then>
<h1>{categories.0.headline}</h1>
</f:then>
<f:else>
<h1>News Category</h1>
</f:else>
</f:if>
there is no field headline in a category. Use title which should work out well.
You can do like this.
<f:if condition="{news.0.categories}">
<f:then>
<f:for each="{news.0.categories}" as="Category">
<h1>{Category.title}</h1>
</f:for>
</f:then>
<f:else>
<h1>News Category</h1>
</f:else>
</f:if>

TYPO3 7.6. Lightbox for the extension calendarize

I try to build the link for a lightbox in my template of the extension calendarize.
The smaller images are correct, but in my lightbox wrong images are shown.
The title, the description ... are fine
<f:for each="{event.images}" as="image" iteration="i">
<a href="{f:uri.image(src:image.uid)}"
class="lightbox" rel="lightbox[{image.uid}]"
title="{image.originalResource.title}"
alt="{image.originalResource.alternative}">
<f:image src="{image.uid}" treatIdAsReference="1"
alt="{image.originalResource.title}"
maxWidth="200"
class="img-rounded"/>
</a>
<figcaption>{image.originalResource.title}</figcaption>
</f:for>
Thanks for any help.
I solved the problem by myself. I had to add
treatIdAsReference:1
to get
<a href="{f:uri.image(src:image.uid treatIdAsReference:1)}"