You are here

function stylizer_theme in Chaos Tool Suite (ctools) 7

Implementation of hook_theme to load all content plugins and pass thru if necessary.

File

stylizer/stylizer.module, line 111
Stylizer module.

Code

function stylizer_theme() {
  $theme = array();
  ctools_include('stylizer');

  // Register all themes given for basetypes.
  $plugins = ctools_get_style_bases();
  $base_types = ctools_get_style_base_types();
  foreach ($plugins as $plugin) {
    if (!empty($base_types[$plugin['module']][$plugin['type']]) && !empty($plugin['theme'])) {
      $base_type = $base_types[$plugin['module']][$plugin['type']];
      $theme[$plugin['theme']] = array(
        'variables' => $base_type['theme variables'],
        'path' => $plugin['path'],
      );

      // If no theme function exists, assume template.
      if (!function_exists("theme_{$plugin['theme']}")) {
        $theme[$plugin['theme']]['template'] = str_replace('_', '-', $plugin['theme']);

        // For preprocess.
        $theme[$plugin['theme']]['file'] = $plugin['file'];
      }
    }
  }
  return $theme;
}