function exif_custom_map_edit_form in EXIF Custom 7
Form API callback to edit a mapping.
1 string reference to 'exif_custom_map_edit_form'
- exif_custom_menu in ./
exif_custom.module - Implements hook_menu().
File
- ./
exif_custom.edit.inc, line 11
Code
function exif_custom_map_edit_form() {
// Let's get the mid.
$mid = arg(5);
// Load mappings.
$sql = 'SELECT * FROM {exif_custom_mapped_fields} WHERE mid = :mid';
$results = db_query($sql, array(
':mid' => $mid,
));
// Load fields possible to map to.
$fields = field_info_instances('file', 'image');
$select_fields = array();
// Allow mapping to title field.
$select_fields['filename'] = 'File name';
// Allow no field to be selected.
$select_fields['none'] = 'none';
foreach ($fields as $field => $field_data) {
$select_fields[$field] = $field_data['label'];
}
$form['mappings-table-start'] = array(
'#markup' => '<table><thead><tr><td><strong>EXIF field</strong></td><td><strong>Example</strong></td><td><strong>Mapped to</strong></td></tr></thead>',
);
while ($result = $results
->fetchObject()) {
$form[$result->exif_field] = array(
'#markup' => $result->exif_field,
'#prefix' => '<tr><td>',
'#suffix' => '</td>',
);
$form['example:' . $result->exif_field] = array(
'#markup' => $result->exif_example,
'#prefix' => '<td>',
'#suffix' => '</td>',
);
$form['img_field:' . $result->exif_field] = array(
'#type' => 'select',
'#default_value' => $result->img_field,
'#options' => $select_fields,
'#prefix' => '<td>',
'#suffix' => '</td></tr>',
);
}
$form['mappings-table-end'] = array(
'#markup' => '</table>',
);
$form['delete'] = array(
'#type' => 'checkboxes',
'#title' => 'Delete',
'#options' => array(
'delete' => t('Delete this mapping'),
),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => 'Save',
);
$form['#validate'][] = 'exif_custom_map_edit_validate';
$form['#submit'][] = 'exif_custom_map_edit_submit';
return $form;
}