You are here

function emfield_implement_types in Embedded Media Field 6

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

This returns a list of content types that are implemented by emfield.

1 call to emfield_implement_types()
_emfield_emfield_widget_settings in ./emfield.cck.inc

File

./emfield.module, line 97
Embedded Media Field is a CCK-based framework for 3rd party media files.

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 = $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 (!empty($modules[$field_types[$field['type']]['module']])) {

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