public function CalendarSystemsBlock::blockSubmit in Calendar Systems 8.3
Overrides BlockPluginTrait::blockSubmit
File
- src/
Plugin/ Block/ CalendarSystemsBlock.php, line 95
Class
- CalendarSystemsBlock
- Provides a block to show a localized current/relative date.
Namespace
Drupal\calendar_systems\Plugin\BlockCode
public function blockSubmit($form, FormStateInterface $form_state) {
$this
->setConfigurationValue('calendar_systems_format', $form_state
->getValue('calendar_systems_format'));
$this
->setConfigurationValue('calendar_systems_calendar', $form_state
->getValue('calendar_systems_calendar'));
$this
->setConfigurationValue('calendar_systems_timezone', $form_state
->getValue('calendar_systems_timezone'));
if (strpos($form_state
->getValue('calendar_systems_text'), '{}') < 0) {
Drupal::messenger()
->addWarning(t('Invalid content, content set to {}'));
$this
->setConfigurationValue('calendar_systems_text', '{}');
}
else {
$this
->setConfigurationValue('calendar_systems_text', $form_state
->getValue('calendar_systems_text'));
}
$c = $form_state
->getValue('cache');
if ($c !== '' && is_numeric($c) && $c >= 0) {
$this
->setConfigurationValue('cache', $form_state
->getValue('cache'));
}
else {
Drupal::messenger()
->addStatus('block cache time set to one hour');
$this
->setConfigurationValue('cache', 3600);
}
}