Heritage - How to add an attribute to every classes ?

Author Message

Antoine W.

Monday 06 June 2005 7:39:10 am

Hello,

I would like to set, for each object, if a left menu must be displayed or not.

So I must add an attribute in <b>every</b> classes in eZ publish (folder, gallery, image, article, ...).
Is it a way to do this easily, or must I edit every classes ?

Is <b>heritage</b> of attributes between classes planned for next versions of eZ publish ?

Thanks

Tom Couwberghs

Sunday 12 June 2005 11:53:48 pm

Hello Antoine,

there is no such thing as heritage of attributes in OO -languages, so I guess the ez-crew will not implement that.

Can't you structure your content in such a way that you could decide on a higher level (subtree, section) whether to show the left menu or not?
I've never encountered a situation where I needed this on object level.

Kind regards,

Tom

Paul Borgermans

Monday 13 June 2005 1:08:19 am

Hi

Inheritance is of course a key concept in OO languages. There was a discussion on this topic (ezp class inheritance) during the summer camp, but nothing decided yet. A virtual datatype that encapsulates any existing class would be a possibility too.

The idea of having custom defined attributes (like dublin core) for all classes has been brought up before in the forums too.

Antoine, I would reconsider what you want to achieve like Tom mentioned, maybe provide a "switch" with custom defined template variables to wether or not display a left-menu. Otherwise, you'll have to edit every class ...

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Tom Couwberghs

Monday 13 June 2005 3:59:09 am

Indeed Paul,

I must agree about the inheritance thing.

But we're still talking about content classes here, and not about an average OO-class.
I wasn't aware of the fact that the crew was considering it, it might be interesting to solve other problems.

Antoine W.

Tuesday 14 June 2005 5:25:12 am

Thanks for your answers.
In fact, I would like to define for some objects which items should be displayed in left menu (menu will be hidden if there's no items).
That's why I need to have an "Object relations" attribute for these objects. Putting this into templates wouldn't be enough flexible.
I think I'll create this attribute for most used classes (Folder, Article and Product) and I'll test in templates if this attribute exists for current node (in data_map). If not, menu will be hidden. So I wont have to edit every classes.

Geraint Edwards

Tuesday 14 June 2005 7:55:13 am

Whoops - ignore this.

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