public function Countdown::blockSubmit in Countdown 8
Implements a block submit handler.
Save configuration into system.
Overrides BlockPluginTrait::blockSubmit
File
- src/
Plugin/ Block/ countdown.php, line 245
Class
- Countdown
- Provides a 'Countdown' Block.
Namespace
Drupal\countdown\Plugin\BlockCode
public function blockSubmit($form, FormStateInterface $form_state) {
// Save our custom settings when the form is submitted.
$this
->setConfigurationValue('event_name', $form_state
->getValue('countdown_event_name'));
$this
->setConfigurationValue('url', $form_state
->getValue('countdown_url'));
$this
->setConfigurationValue('accuracy', $form_state
->getValue('countdown_accuracy'));
$timestamp = $form_state
->getValue('target_time');
$countdown_timestamp = mktime((int) $timestamp['hour'], (int) $timestamp['min'], (int) $timestamp['sec'], (int) $timestamp['month'], (int) $timestamp['day'], (int) $timestamp['year']);
$this
->setConfigurationValue('timestamp', $countdown_timestamp);
}