how to get to 'location' of Link class using treemenu

how to get to 'location' of Link class using treemenu

Monday 17 March 2008 11:46:51 pm - 4 replies

Author Message

André R.

Tuesday 18 March 2008 2:28:06 am

How would you rather like to solve it?

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Michal Slocinski

Tuesday 18 March 2008 12:02:21 pm

well, ideally

{$menu.url}

Should be context aware and in case when object is Link class instance it should just return location instead of link to that node. This naturally could be configurable.

Less perfect solution, but what would also save some typing, is if structures returned by treemenu operator would contain ezcontentobjecttreenode object so I wouldn't have to fetch it manually.

Another useful feature of teemenu operator would be to allow for more complex filtering like in case fetch/list operator. It happens frequently that I need to filter elements out by priority. This also cannot be easily achieved at the moment so again I need to fetch node object manually, compare priority and do something basing on the outcome of comparison.

I think generally fetch/list operator is really robust, would be really helpful to have treemenu little closer to that one.

One more question not completely related to this topic. I'm not familiar with implementing new operators, but from what I saw I think you need to always implement it in PHP. Is there a way to implement some operator using template language? I'm thinking of some kind of operator I could implement which would internally use treemenu but do some stuff around it like what I described above with URLs or priorities and reuse it later in different places. Would be nice to be able to do it using template language as I (and probably most of other people) know it better than internal PHP API of eZ publish.

André R.

Tuesday 18 March 2008 1:23:19 pm

Well the node.url is the url of the node, even if it is a link object it still has it right to have a url / path / location.
I don't think it would have been a good thing if you suddenly couldn't link to some object because some of it attributes had 'magic functionality'.

When it comes to template operators, they need to be written in php, but that doesn't mean you can't reuse the treemenu operator from with in php or make a custom copy of it that does whatever you want it to do. The best way to learn template operators is to take a look at the ones in the contribution area or on projects.ez.no

If you want to reuse code with only template code you can always use includes.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Michal Slocinski

Tuesday 18 March 2008 2:07:16 pm

thanks for answers, I understand that implementing such functionality would require probably bigger redesign

I'm going to play more with includes but anyway - improving treemenu robustness in terms of filtering / fetching nodes out-of-the-box would be good improvement

You must be logged in to post messages in this topic!

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.