I'd like to know if it is possible to get the current widgets of a node ?

field_info_widget_types() shows all the widget

But I'd like to get the widgets the current page is using and not all of them :(

Is there a way to to it ?


2 Answers 2


From the docs of field_info_widget_types() :

Returns information about field widgets from hook_field_widget_info().


$widget_type: (optional) A widget type name. If omitted, all widget types will be returned.

You might be leaving the parameter empty. Hence, it is returning all field widgets. Pass the name of the widget from the current node, to get the right information. You can use menu_get_object() to get the node object of the current page, and find the appropriate widget to pass to field_info_widget_types().

  • well if I try field_info_widget_types('geofield_openlayers'); it will give only information about it regardless if it is in the current node
    – GwenM
    Commented Jul 23, 2013 at 9:42

I found the solution and I also find a way to display all the field used in the current node !

function mymodule_form_alter(&$form, $form_state, $form_id){    

    $instance = field_info_instances($entity, $bundle);
        foreach ($instance as $key => $value) {
            $widgetlist[$key] = $value['widget']['type'];
        foreach ($instance as $key => $value) {
            $fieldlist[$key] = $value['field_name'];

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.