function form_fields_destroy in Image FUpload 6.3
Removing a given list of fields (ckk, node, imagefield, taxonomy) of form Validation for these fields will also be deactivated
1 call to form_fields_destroy()
- image_fupload_imagefield_form_alter in image_fupload_imagefield/
image_fupload_imagefield.module - Implementation of hook_form_alter() registry.
File
- image_fupload_imagefield/
image_fupload_imagefield.module, line 529
Code
function form_fields_destroy(&$form, $fields_to_remove = array()) {
// collect information about fields being used by image preview list, if needed
$fields = array();
if (count($fields_to_remove)) {
foreach ($fields_to_remove as $key) {
$elements = explode("_", $key, 2);
if (!isset($fields[$elements[0]]) && $fields_to_remove[$key] != FALSE) {
$fields[$elements[0]] = array();
}
if ($fields_to_remove[$key] != FALSE) {
array_push($fields[$elements[0]], $elements[1]);
}
}
}
// any node specific fields which should be removed ..argg
if (isset($fields['node'])) {
if (in_array("title", $fields['node'])) {
unset($form['title']);
}
if (in_array("description", $fields['node'])) {
unset($form['body_field']);
}
}
if (isset($fields['taxonomy'])) {
// remove taxonomy items if necessary
for ($i = 0; $i < count($fields['taxonomy']); $i++) {
unset($form['taxonomy'][$fields['taxonomy'][$i]]);
unset($form['taxonomy']['tags'][$fields['taxonomy'][$i]]);
if (!count($form['taxonomy']['tags'])) {
unset($form['taxonomy']['tags']);
}
}
// still anything left to render?
if (count(taxonomy_get_vocabularies($form['#node']->type)) == count($fields['taxonomy'])) {
unset($form['taxonomy']);
}
}
if (isset($fields['cck'])) {
// remove cck fields if necessary
for ($i = 0; $i < count($fields['cck']); $i++) {
unset($form[$fields['cck'][$i]]);
unset($form['#field_info'][$fields['cck'][$i]]);
}
if (!count($form['#field_info'])) {
unset($form['#field_info']);
}
}
}