You are here

public function CurrentTime::submitConfigurationForm in RNG - Events and Registrations 8.2

Same name and namespace in other branches
  1. 8 src/Plugin/Condition/CurrentTime.php \Drupal\rng\Plugin\Condition\CurrentTime::submitConfigurationForm()
  2. 3.x src/Plugin/Condition/CurrentTime.php \Drupal\rng\Plugin\Condition\CurrentTime::submitConfigurationForm()

Form submission handler.

Parameters

array $form: An associative array containing the structure of the plugin form as built by static::buildConfigurationForm().

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form. Calling code should pass on a subform state created through \Drupal\Core\Form\SubformState::createForSubform().

Overrides ConditionPluginBase::submitConfigurationForm

1 call to CurrentTime::submitConfigurationForm()
RuleScheduler::submitConfigurationForm in src/Plugin/Condition/RuleScheduler.php
Form submission handler.
1 method overrides CurrentTime::submitConfigurationForm()
RuleScheduler::submitConfigurationForm in src/Plugin/Condition/RuleScheduler.php
Form submission handler.

File

src/Plugin/Condition/CurrentTime.php, line 83

Class

CurrentTime
Evaluates if the current date is before or after the the configured date.

Namespace

Drupal\rng\Plugin\Condition

Code

public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {

  // Disable saving this plugin if it is not actively enabled.
  $enabled = $form_state
    ->getValue('enable');
  if (!$enabled) {
    return;
  }
  $this
    ->setConfig('enable', $enabled);
  $this
    ->setConfig('date', $form_state
    ->getValue('date')
    ->format('U'));
  parent::submitConfigurationForm($form, $form_state);
}