You are here

function emfield_init in Embedded Media Field 6.2

Implementation of hook_init().

File

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

Code

function emfield_init() {
  global $emfield_registered_classes;

  // Build our media object class registry.
  foreach (module_implements('emfield_register') as $module) {
    foreach (module_invoke($module, 'emfield_register') as $class_name => $class) {
      $emfield_registered_classes[$class_name] = is_array($class) ? $class : array();
      if (!isset($emfield_registered_classes[$class_name]['class_name'])) {
        $emfield_registered_classes[$class_name]['class_name'] = $class_name;
      }
      if (!isset($emfield_registered_classes[$class_name]['name'])) {
        $emfield_registered_classes[$class_name]['name'] = $class_name;
      }
      if (!isset($emfield_registered_classes[$class_name]['path'])) {
        $emfield_registered_classes[$class_name]['path'] = drupal_get_path('module', $module);
      }
      if (!isset($emfield_registered_classes[$class_name]['file'])) {
        $emfield_registered_classes[$class_name]['file'] = $class_name . '.inc';
      }
    }
  }

  // Ensure the proper files are loaded when a new media object is initiated.
  spl_autoload_register('emfield_autoload');
}