function theme_mee_formatter_default in Scald: Media Management made easy 6
File
- mee/
mee.module, line 275 - Defines a special textarea, with drag and drop media driven by Scald and dnd.module when rich text editing is enabled on the textarea via the WYSIWYG API.
Code
function theme_mee_formatter_default($element) {
// What's stored is exactly what the user entered, and not the SAS
// representation. In general, that's that we want to output, *but*
// we should also check that the atom is still available... And replace
// it if it isn't.
if (!variable_get('mee_store_sas', TRUE)) {
$sas = scald_rendered_to_sas($element['#item']['value']);
$included = scald_included($sas);
$altered = FALSE;
foreach ($included as $sid) {
$atom = scald_fetch($sid);
if (!scald_action_permitted($atom, 'view')) {
$altered = TRUE;
$replace = scald_scald_render($atom, 'no-access');
$element['#item']['value'] = preg_replace("/<!--(\\s*)scald={$sid}(.*)END scald={$sid}(\\s*)-->/sU", scald_scald_render($atom, 'no-access'), $element['#item']['value']);
}
}
if ($altered) {
$format = $element['#item']['format'];
$element['#item']['safe'] = check_markup($element['#item']['value'], $format, FALSE);
}
}
// Calling scald_sas_to_rendered here allows us to make the configuration
// a bit easier, as the input format doesn't have to be tweaked to include
// the SAS filter.
return scald_sas_to_rendered($element['#item']['safe']);
}