function forena_pdf_configure in Forena Reports 8
Same name and namespace in other branches
- 7.5 forena_pdf.module \forena_pdf_configure()
- 7.3 forena_pdf.module \forena_pdf_configure()
- 7.4 forena_pdf.module \forena_pdf_configure()
Implementation of configuration form.
Parameters
array $form:
\Drupal\Core\Form\FormStateInterface $form_state:
Return value
$form Form eelements for pdf configuraiton.
1 string reference to 'forena_pdf_configure'
- forena_pdf_menu in forena_pdf/
forena_pdf.module - Implementation of hook_menu
File
- forena_pdf/
forena_pdf.module, line 47 - Forena pdf generation module @author metzlerd
Code
function forena_pdf_configure($form, &$form_state) {
$path = \Drupal::config('forena.settings')
->get('forena_pdf_prince_path');
$disable_links = \Drupal::config('forena.settings')
->get('forena_pdf_disable_links');
$pdf_options = array(
'' => t('None'),
'PDF' => t('Prince XML'),
'MPDF' => t('MPDF'),
);
$pdf_generator = \Drupal::config('forena.settings')
->get('forena_pdf_generator');
$mpdf_path = t('MDPF Libarary not found. Please install so sites/all/libraries/mpdf/mpdf.php exists.');
if (forena_library_file('mpdf')) {
$mpdf_path = 'sites/all/libraries/mpdf';
}
else {
unset($pdf_options['MPDF']);
}
$prince_path = t('Prince XML library not found. Please install so sites/all/libraries/prince/prince.php exists.');
if (forena_library_file('prince')) {
$prince_path = 'sites/all/libraries/prince';
}
else {
unset($pdf_options['PDF']);
}
$form['forena_pdf_generator'] = array(
'#type' => 'select',
'#title' => t('PDF Generation Method'),
'#options' => $pdf_options,
'#default_value' => $pdf_generator,
);
$form['forena_pdf_disable_links'] = array(
'#type' => 'checkbox',
'#title' => 'Disable links in PDF Documents',
'#description' => t('When checked links in reports will not appear as links in PDF documents.'),
'#default_value' => $disable_links,
);
$form['mpdf'] = array(
'#type' => 'fieldset',
'#title' => t('MPDF library'),
);
$form['mpdf']['library'] = array(
'#type' => 'item',
'#title' => 'Installation path',
'#markup' => $mpdf_path,
);
$form['prince'] = array(
'#type' => 'fieldset',
'#title' => t('Prince XML'),
);
$form['prince']['library'] = array(
'#type' => 'item',
'#title' => 'PHP Library path',
'#markup' => $prince_path,
);
$form['prince']['forena_pdf_prince_path'] = array(
'#type' => 'textfield',
'#title' => 'Path to binary',
'#description' => t('Specify the location of the prince executable (e.g. /usr/local/bin/prince'),
'#required' => TRUE,
'#default_value' => $path,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => 'Save',
);
return $form;
}