function atom_reference_widget in Scald: Media Management made easy 6
Implements hook_widget.
File
- atom_reference/
atom_reference.module, line 209 - Defines a new field type, allowing to directly reference Scald Atoms from a node.
Code
function atom_reference_widget(&$form, &$form_state, $field, $items, $delta = 0) {
if ($field['referencable_types']) {
$types = array_keys(array_filter($field['referencable_types']));
}
else {
$types = array();
}
$element = array(
'#type' => $field['widget']['type'],
'#default_value' => isset($items[$delta]) ? $items[$delta] : '',
'#types' => $types,
);
return $element;
}