You are here

public function EnabledModulesSensorPlugin::submitConfigurationForm in Monitoring 8

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 SensorPluginBase::submitConfigurationForm

File

src/Plugin/monitoring/SensorPlugin/EnabledModulesSensorPlugin.php, line 155
Contains \Drupal\monitoring\Plugin\monitoring\SensorPlugin\EnabledModulesSensorPlugin.

Class

EnabledModulesSensorPlugin
Monitors installed modules.

Namespace

Drupal\monitoring\Plugin\monitoring\SensorPlugin

Code

public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
  $sensor_config = $form_state
    ->getFormObject()
    ->getEntity();
  parent::submitConfigurationForm($form, $form_state);
  $modules = $form_state
    ->getValue(array(
    'settings',
    'modules',
  ));
  $hidden_modules = $form_state
    ->getValue(array(
    'settings',
    'extended',
    'modules_hidden',
  ));
  $modules = array_merge(array_filter($modules), array_filter($hidden_modules));
  $sensor_config->settings['modules'] = $modules;
  unset($sensor_config->settings['extended']);
  unset($sensor_config->settings['update_modules']);
}