You are here

function views_data_export_pdf_get_renderer_types in Views Data Export PDF 7

Same name and namespace in other branches
  1. 7.2 views_data_export_pdf.module \views_data_export_pdf_get_renderer_types()

Gets all of the renderers defined on this site.

Return value

array An associative array of all PDF renderers exposed by modules. Each renderer is keyed by its machine name, and the array is sorted by machine name.

See also

hook_pdf_export_renderers()

5 calls to views_data_export_pdf_get_renderer_types()
views_data_export_pdf_plugin_style_export::build_pdf_renderer in plugins/views_data_export_pdf_plugin_style_export.inc
Instantiates the appropriate renderer for exporting a PDF.
views_data_export_pdf_plugin_style_export::build_renderer_selector in plugins/views_data_export_pdf_plugin_style_export.inc
Gets a drop-down populated with options for all renderers on this site.
views_data_export_pdf_plugin_style_export::get_pdf_renderer_type in plugins/views_data_export_pdf_plugin_style_export.inc
Gets the type of renderer for generating PDFs.
views_data_export_pdf_plugin_style_export::validate in plugins/views_data_export_pdf_plugin_style_export.inc
views_data_export_pdf_requirements in ./views_data_export_pdf.install
Implements hook_requirements().

File

./views_data_export_pdf.module, line 102
Main module functions and hooks.

Code

function views_data_export_pdf_get_renderer_types() {
  $renderers = drupal_static(__FUNCTION__);
  if ($renderers === NULL) {
    $renderers = [];
    foreach (module_implements('pdf_export_renderers') as $module_name) {
      $new_renderers = module_invoke($module_name, 'pdf_export_renderers');
      foreach ($new_renderers as &$new_renderer) {

        // Sanity check/validation
        if (!isset($new_renderer['class'])) {
          throw new InvalidArgumentException("Renderer '%s' definition is missing the required 'class' value.");
        }
        if (empty($new_renderer['file path'])) {
          $new_renderer['file path'] = drupal_get_path('module', $module_name);
        }
      }
      $renderers = array_merge($renderers, $new_renderers);
      ksort($renderers);
    }
  }
  return $renderers;
}