0

I have installed multi_upload_filefield_widget.

I would like to change every file widget of every file type fields of every node type programatically.

i would need to automate this change since i have multiple sites and multiple content type.

  //when enabling the module
  function multi_upload_filefield_widget_enable() {
        //code to loop through all node types fields for one site

       // if type is file 
            // replace widget 'file' to 'multiupload
            //save content type with this new value
}

Here is where i am at

       $types = node_type_get_types();

       foreach ($types as $type){   
           $fields=field_info_instances("node",$type->type);

            foreach ($fields as $field){
               if ($field['widget']['module']=='file'){         
                    $field['widget']['module']='multiupload_filefield_widget';
                    $field['widget']['type']='file_mfw';
                }
                 // my fields don't get saved !?
                //field_attach_update("node", $field);
                 //field_update_field ( $field );
             }


          $fields=field_info_instances("node",$type->type);
          print_r($fields);
        }

How can i save these modified fields ?

any help would be appreciated

1 Answer 1

1

It seems like this could do the job: Programmatically change form widget type for a field

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.