You are here

function emfield_implement_types in Embedded Media Field 5

Same name and namespace in other branches
  1. 6.3 deprecated/emfield-deprecated.inc \emfield_implement_types()
  2. 6 emfield.module \emfield_implement_types()
  3. 6.2 emfield.module \emfield_implement_types()

this returns a list of content types that are implemented by emfield

3 calls to emfield_implement_types()
emfield_emfield_widget_settings in ./emfield.module
Widgets *
emimport_settings in contrib/emimport/emimport.module
callback page for /admin/content/emfield/import.
emimport_types_allowing_import in contrib/emimport/emimport.module
this returns a list of content types that are allowed to import media sets, and that have providers allowing that

File

./emfield.module, line 223

Code

function emfield_implement_types($cached = TRUE) {
  static $types;
  if (!isset($types) || !$cached) {

    // if it's a cachable request, try to load a cached value
    if ($cached && ($cache = cache_get('emfield_implement_types', 'cache'))) {
      $types = unserialize($cache->data);
    }
    else {
      $system_types = _content_type_info();
      $content_types = $system_types['content types'];
      $field_types = $system_types['field types'];

      // the array that will store type/field information for provider import
      $types = array();
      $modules = array();
      foreach (module_implements('emfield_info', TRUE) as $module) {
        $modules[$module] = $module;
      }

      // settings per content type for the module
      foreach ($content_types as $content_type => $type) {

        // determine which content types implement this module
        foreach ($type['fields'] as $field_type => $field) {

          // if this field type is defined by this module, then include it here
          if ($module = $modules[$field_types[$field['type']]['module']]) {

            // settings per content type per module
            $types[$module][$content_type][$field_type] = $field;
          }
        }
      }
    }
  }
  cache_set('emfield_implement_types', 'cache', serialize($types), CACHE_PERMANENT);
  return $types;
}