function _mee_load_resources in Scald: Media Management made easy 7
Load used resource in an entity into an array.
Parameters
$item renderable array to render the field:
2 calls to _mee_load_resources()
- mee_field_widget_form_alter in modules/
fields/ mee/ mee.module - Implements hook_field_widget_form_alter().
- _mee_process_item_value in modules/
fields/ mee/ mee.module - Extracts sids and copyright from $item. Updates $item if necessary.
File
- modules/
fields/ mee/ mee.module, line 846 - Defines a special textarea, with drag and drop media driven by Scald and dnd.module.
Code
function _mee_load_resources($entity_type, $entity, $field, $delta, &$item) {
list($id, $revision_id) = _mee_extract_id($entity_type, $entity);
$result = db_select('mee_resource', 'r')
->fields('r', array(
'atom_sid',
'weight',
'required',
))
->condition('entity_type', $entity_type)
->condition('entity_id', $id)
->condition('revision_id', $revision_id)
->condition('field', $field['field_name'])
->condition('delta', $delta)
->execute();
$item['mee']['resource_manager'] = array();
$item['mee']['resource_manager'] = $result
->fetchAllAssoc('atom_sid', PDO::FETCH_ASSOC);
$item['mee']['resource_manager'][0] = array(
'weight' => 0,
'required' => FALSE,
);
}