[TYPO3-dev] Alphabetic menu sorting with Fluid

Stephan Schuler Stephan.Schuler at netlogix.de
Tue Jul 8 11:09:39 CEST 2014


Hi Mark.

Usualy sorting isn't done in fluid but when querying for data. Think about $newsRepository->findAll(), which returns like an infinite number of results. You clearly don't want to have those thrown into fluid rendering entirely but you expect the database query to return objects in the correct order. I guess that's the reason why still with 6.2 there is no sortViewHelper that can sort things.

But that's not even close to your problem, it only fits 80% of the words of your subject :).

You refer to the vhs page.menu ViewHelper
Here's the documentation:
http://fluidtypo3.org/viewhelpers/vhs/master/Page/MenuViewHelper.html

There is no mechanism to sort anything, unfortunately. At least not with any fluid argument.

https://github.com/FluidTYPO3/vhs/blob/master/Classes/ViewHelpers/Page/MenuViewHelper.php
https://github.com/FluidTYPO3/vhs/blob/master/Classes/ViewHelpers/Page/Menu/AbstractMenuViewHelper.php
https://github.com/FluidTYPO3/vhs/blob/master/Classes/Service/PageSelectService.php
This is the source code.

As far as I can tell, there is no way to adjust the order. The VHS PageSelectService just asks the TYPO3 core Page/PageRepository for the menu order by "sorting".

You might extend the MenuViewHelper, overwrite the "getMenu" function and introduce sorting here. If that works for you, maybe you could push that code upstream.

Regards,


Stephan Schuler
Web-Entwickler

Telefon: +49 (911) 539909 - 0
E-Mail: Stephan.Schuler at netlogix.de
Website: media.netlogix.de






--
netlogix GmbH & Co. KG
IT-Services | IT-Training | Media
Neuwieder Straße 10 | 90411 Nürnberg
Telefon: +49 (911) 539909 - 0 | Fax: +49 (911) 539909 - 99
E-Mail: info at netlogix.de | Internet: http://www.netlogix.de

netlogix GmbH & Co. KG ist eingetragen am Amtsgericht Nürnberg (HRA 13338)
Persönlich haftende Gesellschafterin: netlogix Verwaltungs GmbH (HRB 20634)
Umsatzsteuer-Identifikationsnummer: DE 233472254
Geschäftsführer: Stefan Buchta, Matthias Schmidt



-----Ursprüngliche Nachricht-----
Von: typo3-dev-bounces at lists.typo3.org [mailto:typo3-dev-bounces at lists.typo3.org] Im Auftrag von Mark Howells-Mead
Gesendet: Dienstag, 8. Juli 2014 10:13
An: List for Core-/Extension development
Betreff: [TYPO3-dev] Alphabetic menu sorting with Fluid

Hi all

I have a tricky menu problem, which I hope someone else may be able to advise on. v:page.menu in Fluid allows one to output a regular menu, using the regular page sorting defined using the tree structure in the backend. However, one section of the menu I’m creating contains subpages which need to be sorted alphabetically.

For example

• About Us
• Products
• Glossary A-Z
        • Apples
        • Bananas
        • Currants
• Contact

This is usually no problem, but the website is multilingual and because the site uses a single tree structure (so that direct language switching is possible), the menu order for the alphabetic section is wrong in the second language, thus.

• Glossaire A-Z
        • Pommes
        • Bananes
        • Raisins

I can add a field to “Glossary A-Z” in the page settings to say that subpages should be sorted alphabetically, but I haven’t found out how to do the actual sorting for that specific set of subpages. Has anyone come across this requirement and solved it?

Many thanks
Mark Howells-Mead
_______________________________________________
TYPO3-dev mailing list
TYPO3-dev at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-dev


More information about the TYPO3-dev mailing list