You are here

function dnd_scald_wysiwyg_context_list in Scald: Media Management made easy 7

Get the list of Scald contexts that can be used in a WYSIWYG, keyed by type.

Return value

array Returns an associative array, keyed by the atom type machine name and whose values are associative arrays, each keyed by the context machine name and whose values are the user facing name of this context for this atom type.

2 calls to dnd_scald_wysiwyg_context_list()
dnd_library in modules/library/dnd/dnd.module
Implements hook_library().
dnd_scald_wysiwyg_context_slugs in modules/library/dnd/dnd.module
Get the list of Scald contexts machine names that are allowed in WYSIWYG.

File

modules/library/dnd/dnd.module, line 52

Code

function dnd_scald_wysiwyg_context_list() {
  $contexts =& drupal_static(__FUNCTION__, NULL);
  if (!isset($contexts)) {
    $types = scald_types();
    foreach (scald_contexts_public() as $name => $definition) {
      if (empty($definition['parseable'])) {
        continue;
      }

      // There "formats" is actually used nowhere in Scald. Every context is
      // available to all atom types.
      $definition['formats'] = $types;
      foreach ($definition['formats'] as $type => $data) {
        $contexts[$type][$name] = $definition['title'];
      }
    }
    drupal_alter('scald_wysiwyg_context_list', $contexts);
  }
  return $contexts;
}