function _mee_process_item_value in Scald: Media Management made easy 7
Extracts sids and copyright from $item. Updates $item if necessary.
2 calls to _mee_process_item_value()
- text_field_insert in modules/
fields/ mee/ mee.module - Implements hook_field_insert() on behalf of Text module.
- text_field_update in modules/
fields/ mee/ mee.module - Implements hook_field_update() on behalf of Text module.
File
- modules/
fields/ mee/ mee.module, line 798 - Defines a special textarea, with drag and drop media driven by Scald and dnd.module.
Code
function _mee_process_item_value(&$item, $entity_type, $entity, $field, $delta) {
if (mee_store_format() == 'embed_div') {
$sids = array();
$copyrights = array();
// Collect the emebed data.
foreach (_mee_extract_widget_embed_info(filter_dom_load($item['value'])) as $info) {
$sids[] = $info['sid'];
$copyrights[$info['sid']] = $info['caption'];
}
if (!empty($item['summary'])) {
foreach (_mee_extract_widget_embed_info(filter_dom_load($item['summary'])) as $info) {
$sids[] = $info['sid'];
$copyrights[$info['sid']] = $info['caption'];
}
}
$sids = array_unique($sids);
}
else {
// $sids contains the list of atom sid actually used in the item.
$sas = scald_rendered_to_sas($item['value']);
$scald_included = scald_included($sas);
$sids = array_unique($scald_included);
// Parse copyright informations.
$copyrights = mee_extract_copyrights($item['value']);
}
// If $item['mee'] does not hold anything, load default data into it.
if (empty($item['mee']) || !is_array($item['mee']['resource_manager'])) {
_mee_load_resources($entity_type, $entity, $field, $delta, $item);
}
// Finally, if there was unknown client-side problem, we might not have new
// inserted resources. We set default value for them.
foreach ($sids as $sid) {
if (!isset($item['mee']['resource_manager'][$sid])) {
$item['mee']['resource_manager'][$sid] = array(
'required' => FALSE,
'weight' => 0,
);
}
}
return array(
$sids,
$copyrights,
);
}