[support] Where to put code common to some computed_fields ?
Anthony Malkoun
malkouna at yahoo.com.au
Wed Mar 30 22:26:47 UTC 2011
I would say put the bulk of the code in a "helper" function, which can
be called anything, and then the individual methods for the individual
fields are just wrappers that call that function.
Oh sorry, meant to mention, don't put it in a field at all, but use
computed field's ability to call code in a module.
HTH,
Malks.
On 6:59 AM, Xavier Bestel wrote:
> Hi,
>
> I have added 4 computed fields to a node type (the "profile" node type,
> in case you wonder), and all of them have nearly the same code to
> compute their value. I'd like to create a function to write/debug the
> code only once, but where can I put it ? Would it work if I put it in
> the first field only ?
>
> My computed fields are save in the database (they are used in views), if
> that matters.
>
> Thanks,
> Xav
>
>
>
> PS: please Cc: me on answers
>
>
More information about the support
mailing list