Return to Snippet

Revision: 20469
at November 16, 2009 15:15 by kosmikko


Updated Code
function move_form_element(&$form, $name, $new_category, $weight = NULL)
{
	$form[$new_category][$name] = $form[$name];
	if($weight != NULL)
	{
		$form[$new_category][$name]['#weight'] = $weight;
	}
	unset($form[$name]);
}

Revision: 20468
at November 16, 2009 15:14 by kosmikko


Initial Code
function keventajat_move_form_element(&$form, $name, $new_category, $weight = NULL)
{
	$form[$new_category][$name] = $form[$name];
	if($weight != NULL)
	{
		$form[$new_category][$name]['#weight'] = $weight;
	}
	unset($form[$name]);
}

Initial URL

                                

Initial Description
Move form element into category. Helper for organizing the form

Initial Title
Move form element

Initial Tags
textmate, drupal

Initial Language
PHP