You are here

function oa_related_theme in Open Atrium Related Content 7.2

Implements hook_theme().

File

./oa_related.module, line 26

Code

function oa_related_theme($existing, $type, $theme, $path) {
  $theme = array();
  $path = $path . '/templates';
  $theme['oa_related_files'] = array(
    'template' => 'oa-related-files',
    'variables' => array(),
    'path' => $path,
  );
  $theme['oa_related_ref'] = array(
    'template' => 'oa-related-ref',
    'variables' => array(),
    'path' => $path,
  );
  $theme['oa_related_paragraphs_media_render'] = array(
    'path' => $path,
    'base hook' => 'entity',
    'template' => 'oa-related-paragraphs-media-render',
    'render element' => 'element',
  );
  $theme['oa_related_paragraphs_text_render'] = array(
    'path' => $path,
    'base hook' => 'entity',
    'template' => 'oa-related-paragraphs-text-render',
    'render element' => 'element',
  );
  $theme['oa_related_paragraphs_content_render'] = array(
    'path' => $path,
    'base hook' => 'entity',
    'template' => 'oa-related-paragraphs-content-render',
    'render element' => 'element',
  );
  $theme['oa_related_paragraphs_snippet_render'] = array(
    'path' => $path,
    'base hook' => 'entity',
    'template' => 'oa-related-paragraphs-snippet-render',
    'render element' => 'element',
  );

  // Get all of the paragraph types.
  $bundles = paragraphs_bundle_load();

  // Add all of our paragraph bundles dynamically.
  foreach ($bundles as $machine_name => $bundle) {
    $filename = 'oa-related-paragraphs-' . $machine_name . '-form';
    if (file_exists($path . '/' . $filename . '.tpl.php')) {
      $theme['oa_related_paragraphs_' . $machine_name . '_form'] = array(
        'template' => $filename,
        'render element' => 'element',
        'path' => $path,
      );
    }
  }
  return $theme;
}