0

This question already has an answer here:

Is there possibility to use field widgets to create these kinds of fields? I can't find any information how to use it while form creating.

I found something like this http://devblog.com.au/using-the-date-widget-with-drupals-form-api but I'm looking for another widgets info (how to use it).

In addition, I don't use the entity type in this case (custom structure).

marked as duplicate by Clive Jul 16 '13 at 13:20

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    I get the impression you're adding to the question because you don't think it's a duplicate...the answers in the duplicated post are literally the only way to get a field widget into a custom form in Drupal. Field widgets are completely separate from the form API, having one attached to an entity instance and using those methods are the only way to get the job done – Clive Jul 16 '13 at 13:45
  • Yes, I thought like that :). I was disapointed, because there is a function argument about a entity type and I don't have entity type value right now. So I need to switch to the entity API to be able to use field widgets? – deem Jul 16 '13 at 13:50
  • 1
    As strange as it sounds, yes :) The widget system is decoupled in Drupal 8 so this would be a lot easier, but for Drupal 7 you need a field attached to an entity instance just to get this done. Field widgets just can't exist with the underlying entity field at the moment unfortunately. You can always hide the field on the relevant entity edit form/display page though if you don't want to show it. It's a dirty solution, but might be quicker than writing your own version of one of the rich field widgets :) – Clive Jul 16 '13 at 13:55

Browse other questions tagged or ask your own question.