protected function views_data_export_pdf_plugin_style_export::build_renderer_selector in Views Data Export PDF 7
Same name and namespace in other branches
- 7.2 plugins/views_data_export_pdf_plugin_style_export.inc \views_data_export_pdf_plugin_style_export::build_renderer_selector()
Gets a drop-down populated with options for all renderers on this site.
Return value
array An associative array containing the titles of all PDF renderers exposed by modules. Each description is keyed by its machine name.
See also
1 call to views_data_export_pdf_plugin_style_export::build_renderer_selector()
- views_data_export_pdf_plugin_style_export::options_form in plugins/
views_data_export_pdf_plugin_style_export.inc - Options form mini callback.
File
- plugins/
views_data_export_pdf_plugin_style_export.inc, line 427 - PDF style plugin.
Class
- views_data_export_pdf_plugin_style_export
- @file PDF style plugin.
Code
protected function build_renderer_selector() {
$all_renderer_info = views_data_export_pdf_get_renderer_types();
$renderer_options = [];
$descriptions = [];
foreach ($all_renderer_info as $machine_name => $renderer_info) {
$title = $renderer_info['title'];
$description = $renderer_info['description'];
$renderer_options[$machine_name] = $title;
$descriptions[] = sprintf('<dt><strong>%s</strong></dt><dd>%s</dd>', $title, $description);
}
$description = '<p>' . t('Specifies how HTML is rendered to PDF. Options:') . '</p>' . '<dl>' . implode('', $descriptions) . '</dl>';
/** @noinspection PhpUnnecessaryLocalVariableInspection */
$selector = [
'#type' => 'select',
'#title' => t('PDF renderer'),
'#description' => $description,
'#options' => $renderer_options,
'#default_value' => $this
->get_pdf_renderer_type(),
];
return $selector;
}