eZ Community » Forums » General » Selecting multiple objects at once...
expandshrink

Selecting multiple objects at once for object relations

Selecting multiple objects at once for object relations

Saturday 11 March 2006 3:27:02 pm - 3 replies

I have some questions about the Object Relations datatype and the Enhanced Object Relation datatype.

1. I would like to be able to specify a starting location to browse for objects. Now it always starts in the root folder of the content tree. I always have to switch to Media folder first when I need to select an Image object. Is there a way to specify a location for browsing?

2. The Object Relations datatype only lets you select one object at a t ime, using the radio button. I wuld like to be able do select multiple objects from the same folder, which would be easy if the radio buttons were replaced with checkboxes. Can this be done?

3. The Enhanced Object Relation datatyp lets you specify checkboxes as a selection mechanism, and a folder location, but then you can't browse to another location. You can only select from one particular folder. How do you browse for objects in a folder tree with the Enhanced Object Relation datatype?

Sunday 12 March 2006 12:22:32 am

I found out how to do this by studying the comments in the ini files in /settings.
Two ini files control browsing and object selection behaviour:
browse.ini and content.ini

In browse.ini actions are defined for various browsing tasks.
In content.ini these browsing actions can be tied to class attributes. So you can control the browsing behaviour for every class attribute individually.

To customise the browsing behaviour for my admin site, I created browse.ini.append.php and content.ini.append.php files in /settings/siteaccess/admin.

In browse.ini.append.php, I defined additional browsing actions, like this one for selecting multiple images from the Images folder, using checkboxes:

[AddRelatedImages]
StartNode=images
SelectionType=multiple
ReturnType=ObjectID

In the same browse.ini.append.php file, you can specify aliases for folder nodes, like in the above example for the Images folder:

AliasList[]
AliasList[images]=51

In content.ini.append.php, you can then specify which class attributes use which browsing method. I specified the above defined browsing method for an attribute of type Object Relations, which stores relations to Image objects:

[ObjectRelationDataTypeSettings]
ClassAttributeStartNode[]
ClassAttributeStartNode[]=267;AddRelatedImages

267 is the attribute id of my attribute, and AddRelatedImages is the name of the action I defined above in browse.ini.append.php

The default browse action for a Object Relation attribute is AddRelatedObjectToDataType, which is defined in browse.ini as:

[AddRelatedObjectToDataType]
StartNode=content
SelectionType=single
ReturnType=ObjectID

Similarly, the default action for a Object Relations attribute is:

[AddRelatedObjectListToDataType]
StartNode=content
SelectionType=multiple
ReturnType=ObjectID

which is identical, except for the selection type (single vs.multiple ie radio buttons vs. checkboxes)

Tuesday 13 January 2009 12:15:44 pm

Anyone know of a way to add upper and/or lower limits to the number of relations which can be added to the object?
e.g. allow up to 6 relations out of a possible 20?

Thursday 24 July 2014 11:37:40 am

The reply has been removed because of violation of forum rules.

expandshrink

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

36 542 Users on board!

Forums menu

Proudly Developed with from