0

There's a similar question asked here: Use multiple widget types for one field but I was unable to reinstate the question with mine.

I have created a custom field widget with extended capabilities for authenticated users for a field. However the widget strongly relies on the person having a registered user account in the system, but I'd still like anonymous users to be able to input values for the field with the default widget. And to think of it, admins would have more use of the default one aswell.

The field is a customer_profile_reference field, so just rendering another type of field wouldn't work, I suppose (like text field instead).

Is there a way to fall back on the default widget with it's own validation when my custom widget has allready been initiated by being defined as the widget for the field in the UI? Basically I wish for an end result, where my widget would stay untouched if user is anonymous or has admin role, and another one is used.

Appreciate all and any help,

Alari

5
  • The other question you've linked to has the correct answer, where exactly are you stuck implementing it?
    – Clive
    Mar 10, 2016 at 11:29
  • I'm not sure how or where would I implement it. Can I somehow do this in the custom widget module file, so that at the time the new widget has allready been called for I could still direct to use the other widget, or do I have to create a separate module? Mar 10, 2016 at 12:12
  • Why not try it and see? It'll only take a minute, and save you waiting for someone to respond here.
    – Clive
    Mar 10, 2016 at 12:13
  • May I ask if it's possible without using the hook, to do it within the widget initialisation? And even more if I can some how call for the default widget, but also add an element from my custom widget? Mar 10, 2016 at 12:50
  • I can't imagine there's a way to do it without a hook that doesn't involve editing core code in some way. I'm not sure I fully understand what you're trying to do, sorry
    – Clive
    Mar 10, 2016 at 13:29

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.