function exif_helper_form_alter in Exif 6
implementation of hook_form_alter
Parameters
$form_id:
$form:
File
- exif_helper/
exif_helper.module, line 33 - Intention of this little module: exif.module needs to have a weight of -10 at least it has to be processed before CCK is processed, so that EXIF information can be taken from the fields and be written into the CCK fields.
Code
function exif_helper_form_alter(&$form, $form_state, $form_id) {
if ($form['#id'] != 'node-form') {
return;
}
$ar_keys = array();
foreach ($form as $key => $value) {
$ar_keys[] = array(
'field_name' => $key,
);
}
$exif = _exif_get_class();
$ar_exif_fields = $exif
->getExifFields($ar_keys);
$node = $form['#node'];
if ($node->nid > 0 && variable_get('exif_helper_show_on_update', 0) == 0 || !isset($node->nid) && variable_get('exif_helper_show_on_creation', 0) == 0) {
foreach ($ar_exif_fields as $variable) {
$form["field_" . $variable['section'] . "_" . $variable['tag']]['#type'] = 'hidden';
}
}
}