public function RequirementsIgnore::sensorUnignoreKey in Monitoring 8
Removes sensor key from the excluded list.
Parameters
\Drupal\monitoring\Entity\SensorConfig $monitoring_sensor_config:
Return value
\Symfony\Component\HttpFoundation\RedirectResponse
1 string reference to 'RequirementsIgnore::sensorUnignoreKey'
File
- src/
Controller/ RequirementsIgnore.php, line 81 - Contains \Drupal\monitoring\Controller\RequirementsIgnore.
Class
Namespace
Drupal\monitoring\ControllerCode
public function sensorUnignoreKey(SensorConfig $monitoring_sensor_config, $key) {
if (in_array($key, $monitoring_sensor_config->settings['exclude_keys'])) {
if ($index = array_search($key, $monitoring_sensor_config->settings['exclude_keys'])) {
unset($monitoring_sensor_config->settings['exclude_keys'][$index]);
}
$monitoring_sensor_config
->save();
$this
->messenger()
->addMessage($this
->t('Removed the sensor %name (%key) from the excluded list.', array(
'%name' => $monitoring_sensor_config
->getLabel(),
'%key' => $key,
)));
}
$url = $monitoring_sensor_config
->toUrl('details-form');
return $this
->redirect($url
->getRouteName(), $url
->getRouteParameters());
}