public function Settings::buildForm in jQuery World Calendars API 3.x
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/ Settings.php, line 49 - Contains \Drupal\jquery_calendar\Form\JqueryCalendarSettings.
Class
Namespace
Drupal\jquery_calendar\FormCode
public function buildForm(array $form, \Drupal\Core\Form\FormStateInterface $form_state) {
try {
jquery_calendar_requirements_check(null);
} catch (MissingRequirements $e) {
\Drupal::messenger()
->addMessage(Markup::create($e
->getMessage() . ' ' . $this
->t('Checkout the <a href="@link">status reports</a>.', [
'@link' => Url::fromRoute('system.status')
->toString(),
])), \Drupal::messenger()::TYPE_ERROR);
return [];
}
// Library compression level.
$form['compression_level'] = [
'#type' => 'radios',
'#title' => $this
->t('Library default compression level'),
'#description' => $this
->t('Choose default library files compression level. This will be used as a fallback in case that the API implementer does not provide a level.'),
'#default_value' => \Drupal::config('jquery_calendar.settings')
->get('compression_level'),
'#options' => [
'min' => $this
->t('Minified'),
'normal' => $this
->t('No Compression'),
],
];
// Calendars default theme.
$form['datepicker_theme'] = [
'#type' => 'select',
'#title' => $this
->t('Datepicker default theme'),
'#description' => $this
->t('Choose which datepicker theme you want to use. This will override datepicker theme settings set by other modules. You can add your own customized theme by placing it into the <code><u>@dir</u></code> directory respecting this filename format: <strong><em>theme-name</em>.calendars.picker.css</strong>', [
'@dir' => 'sites/all/libraries/jquery.calendars',
]),
'#default_value' => \Drupal::config('jquery_calendar.settings')
->get('datepicker_theme'),
'#options' => jquery_calendar_datepicker_themes(),
];
return parent::buildForm($form, $form_state);
}