function mee_field_attach_view_alter in Scald: Media Management made easy 7
Implements hook_field_attach_view_alter.
Converts the SAS representation to the rendered representation.
File
- modules/
fields/ mee/ mee.module, line 392 - Defines a special textarea, with drag and drop media driven by Scald and dnd.module.
Code
function mee_field_attach_view_alter(&$output, $context) {
$store_format = mee_store_format();
if ($store_format == 'sas' || $store_format == 'embed_div') {
list($id, $revision_id, $bundle) = entity_extract_ids($context['entity_type'], $context['entity']);
$fields = field_info_instances($context['entity_type'], $bundle);
foreach ($fields as $name => $field) {
if (!empty($field['settings']['dnd_enabled']) && isset($output[$name])) {
foreach (element_children($output[$name]) as $key) {
if ($store_format == 'embed_div') {
$input_format = $output[$name]['#items'][$key]['format'];
$list = filter_list_format($input_format);
if (empty($list['mee_scald_widgets']) || $list['mee_scald_widgets']->status != 1) {
$output[$name][$key]['#markup'] = mee_filter_process($output[$name][$key]['#markup']);
}
}
$output[$name][$key]['#markup'] = scald_sas_to_rendered($output[$name][$key]['#markup'], $field['settings']['context'], FALSE, dnd_scald_wysiwyg_context_slugs());
}
}
}
}
}