public function QueueSizeSensorPlugin::buildConfigurationForm in Monitoring 8
Adds UI to select Queue for the sensor.
Overrides SensorPluginBase::buildConfigurationForm
File
- src/
Plugin/ monitoring/ SensorPlugin/ QueueSizeSensorPlugin.php, line 38 - Contains \Drupal\monitoring\Plugin\monitoring\SensorPlugin\QueueSizeSensorPlugin.
Class
- QueueSizeSensorPlugin
- Monitors number of items for a given core queue.
Namespace
Drupal\monitoring\Plugin\monitoring\SensorPluginCode
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form = parent::buildConfigurationForm($form, $form_state);
$queues = \Drupal::service('plugin.manager.queue_worker')
->getDefinitions();
$options = [];
foreach ($queues as $id => $definition) {
$options[$id] = $definition['title'];
}
$form['queue'] = array(
'#type' => 'select',
'#options' => $options,
'#default_value' => $this->sensorConfig
->getSetting('queue'),
'#required' => TRUE,
'#title' => t('Queues'),
);
return $form;
}