public function VisualizationSettingsForm::buildForm in Visualization API 8
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides ConfigFormBase::buildForm
File
- src/
Form/ VisualizationSettingsForm.php, line 37
Class
Namespace
Drupal\visualization\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$options = array();
$type = $this->handler_manager;
foreach ($type
->getDefinitions() as $id => $plugin) {
if ($type
->createInstance($id)
->available()) {
$options[$id] = $plugin['label'];
}
}
$config = $this
->config('visualization.settings');
$form['library'] = array(
'#type' => 'select',
'#title' => t('Preferred charting library'),
'#options' => $options,
'#description' => t('Your charting library of preference will be used when generating charts (as long as it offers support for the requested type). The available options are the charting libraries detected on your system, please refer to the help section for more information about enabling more libraries.'),
'#default_value' => $config
->get('library'),
);
return parent::buildForm($form, $form_state);
}