Jahia in English > add attributes dynamically...

0 (0 Good)
0 (0 Bad)

add attributes dynamically in component

by  bharatkasodariya »  2014/07/28 10:31

Hi,

I want to define some attributes during component setup on the page from the editor instead of cnd file.

Here is some breief about it,

We have different gallary object which has image , title, alt and text as common fields. so common definition is defined as below.

[x:galleryImage] > jnt:content, jmix:editorialContent, mix:title

 - image (weakreference, picker[type='image']) i18n

 - imageAlt (string) i18n

 - imageTitle (string) i18n 

Now different image object are like dress, suit, ring etc. Each has their own facet attributes.

We want to define their facet attribute dynamically in definition. Like If user select gallary component in editor, It will have above thrre attribute by default and he can add/define different (predefined)facet attributes in it and set value in it.

For example if editor wants to define ring gallary image then he can select galllary component and set some extra ring related facet attributes like metal, shape etc.

same For suit image gallary, he can add suite related attributes like style,designer etc.

Can you suggest how can we achieve it.

Thanks,

Bharat

 

 

 

 

 

 

  (bharatkasodariya)

Number of messages  57
Registration date
0 (0 Good)
0 (0 Bad)

Re: add attributes dynamically in component

by  qlamerand »  2014/11/26 17:50

Hello,
If I understand your need correctly, this can easily be implemented by defining mixins that contain some properties and can be applied only on your type.
They will appear in content creation/edit engine as checkboxes that when checked, will add properties.
You would have something like :

[x:ring] mixin
 extends = x:galleryImage
 - metal (string)
 - shape (string)

Regards,
Quentin

  • Re: add attributes dynamically in component
    2014/11/26 17:51

    qlamerand <p>Hello,<br /> If I understand your need correctly, this can easily be implemented by defining mixins that contain some properties and can be applied only on your type.<br /> They will appear in content creation/edit engine as checkboxes that when checked, will add properties.<br /> You would have something like :</p> <blockquote> <p>[x:ring]&nbsp;mixin<br /> &nbsp;extends = x:galleryImage<br /> &nbsp;- metal (string)<br /> &nbsp;- shape (string)</p> </blockquote> <p>Regards,<br /> Quentin</p>

  • Number of messages  28
    Registration date Nov 26, 2014
    Contact
    Share
    Feedback

    Get in touch

    Whether you are a current user or if you are just evaluating Jahia, we are here to help.

    Contact us

    Share this page