I'm trying to write an external module that adds a new FieldField Source.

By implementing hook_filefield_sources_info() I was successful at getting my new source to appear in the "Enabled sources:" fieldset for the field instance.

However, I'm unable to add form inputs to the FileField Sources settings for my new source as filefield_sources_invoke_all('settings', $params) only loops through the available .inc files (ie: it doesn't do a module_invoke_all())

What is the recommended way for my module to add settings inputs for the new filefield source it provides? Simply hook_form_alter?

Comments

tamerzg’s picture

Have the same problem. I ended up using form_alter, here is the code:

 /**
 * Implementation of hook_form_alter().
 */
function custommodule_form_alter(&$form, $form_state, $form_id) {
	if($form_id=='content_field_edit_form'){
		if(isset($form['widget']['filefield_sources'])){
	            //Add your field settings here
		}
	}
}
quicksketch’s picture

Component: Code » General
Status: Active » Fixed

Yep, that's right, just use plain-ol' hook_form_alter().

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

milplus’s picture

i need to hook up () g2image embedded to pick photos in gallery2 albums.

any idea how to do it?