This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » Developer » Heritage - How to add an attribute to...

Heritage - How to add an attribute to every classes ?

Heritage - How to add an attribute to every classes ?

Monday 06 June 2005 4:39:10 pm - 5 replies


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 ?


Monday 13 June 2005 8:53:48 am

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,


Monday 13 June 2005 10:08:19 am


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 ...


Monday 13 June 2005 12:59:09 pm

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.

Tuesday 14 June 2005 2:25:12 pm

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.

Tuesday 14 June 2005 4:55:13 pm

Whoops - ignore this.

Modified on Tuesday 14 June 2005 4:56:39 pm by Geraint Edwards


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

36 542 Users on board!

Forums menu

Proudly Developed with from