Hi Petr, So our 2 use cases are a bit different, if I have understood you correctly:
For you, the information you need is available a-priori, but you need a way to get at it during the field setup process. Basically, AbstractFieldFactory.initializeProperty and initializeTransformer do this work, but don't remember/expose the resolved JCR node/property in the field. For me, I don't have the information a-priori, but only after the fields are constructed and the form displayed to the user. I want a way given the live form to access the information which form field is bound to which JCR property in order to set values directly into the form fields. Both cases can be solved using the code supplied by Jan, but it is a bit ugly (lots of casts means lots of assumptions). Perhaps it might be nice to provide a cleaner way to access the bound JCR properties from inside the field. Regards from Vienna, Richard > -----Ursprüngliche Nachricht----- > Von: [email protected] [mailto:user-list-owner@magnolia- > cms.com] Im Auftrag von Petr Kadlec (via Magnolia Forums) > Gesendet: Dienstag, 07. Jänner 2014 03:08 > An: Magnolia User List > Betreff: [magnolia-user] Re: How to access storage node in FieldDefinition > > Sorry for late response, thank you Jan and Richard, I will give that a try. > > I will try to explain my use case again here with an image, because maybe it > can be done differently and I'm missing how. We have this in 4.5: > 1. Roles - different roles in folders > 2. Workplaces with sections and employees > a. Workplace - user can choose "folder with roles" via select box (custom > control n.1, not dynamic) > b. Employee - "role" select - only roles from one folder are offered > (folder > is defined in workplace - custom control n.2 - needs access to jcr node of > employee to get the "roles folder" property from its parent workplace) > > Generally it's Link field with dynamic treeRootPath that is decided by its > parent node. And displayed as list of items in select for simplicity. > > [img]http://puradesign.cz/dropbox/custom_controls.jpg[/img] > > -- > Context is everything: http://forum.magnolia- > cms.com/forum/thread.html?threadId=a94d6db2-77d4-40df-a09f- > cb0c06205f70 > > > ---------------------------------------------------------------- > For list details, see http://www.magnolia-cms.com/community/mailing- > lists.html > Alternatively, use our forums: http://forum.magnolia-cms.com/ > To unsubscribe, E-mail to: <[email protected]> > ---------------------------------------------------------------- ---------------------------------------------------------------- For list details, see http://www.magnolia-cms.com/community/mailing-lists.html Alternatively, use our forums: http://forum.magnolia-cms.com/ To unsubscribe, E-mail to: <[email protected]> ----------------------------------------------------------------
