You are here

function wysiwyg_load_includes in Wysiwyg 5

Same name and namespace in other branches
  1. 5.2 wysiwyg.module \wysiwyg_load_includes()
  2. 6.2 wysiwyg.module \wysiwyg_load_includes()
  3. 6 wysiwyg.module \wysiwyg_load_includes()
  4. 7.2 wysiwyg.module \wysiwyg_load_includes()

Load include files for wysiwyg implemented by all modules.

Parameters

$type: The type of includes to search for, can be 'editors'.

$hook: The hook name to invoke.

$file: An optional include file name without .inc extension to limit the search to.

See also

wysiwyg_get_directories(), _wysiwyg_process_include()

Related topics

1 call to wysiwyg_load_includes()
wysiwyg_get_all_editors in ./wysiwyg.module
Compile a list holding all supported editors including installed editor version information.

File

./wysiwyg.module, line 642
Integrate client-side editors with Drupal.

Code

function wysiwyg_load_includes($type = 'editors', $hook = 'editor', $file = NULL) {

  // Determine implementations.
  $directories = wysiwyg_get_directories($type);
  $directories['wysiwyg_'] = wysiwyg_get_path($type);
  $file_list = array();
  foreach ($directories as $module => $path) {
    $file_list[$module] = drupal_system_listing("{$file}" . '.inc$', $path, 'name', 0);
  }

  // Load implementations.
  $info = array();
  foreach (array_filter($file_list) as $module => $files) {
    foreach ($files as $file) {
      include_once './' . $file->filename;
      $result = _wysiwyg_process_include('wysiwyg', $module . $file->name, dirname($file->filename), $hook);
      if (is_array($result)) {
        $info = array_merge($info, $result);
      }
    }
  }
  return $info;
}