RequestPathExclusion.php in Context 8.4
File
src/Plugin/Condition/RequestPathExclusion.php
View source
<?php
namespace Drupal\context\Plugin\Condition;
use Drupal\Core\Form\FormStateInterface;
use Drupal\system\Plugin\Condition\RequestPath;
class RequestPathExclusion extends RequestPath {
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form = parent::buildConfigurationForm($form, $form_state);
$form['negate']['#access'] = FALSE;
return $form;
}
public function defaultConfiguration() {
return [
'negate' => TRUE,
] + parent::defaultConfiguration();
}
public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
parent::submitConfigurationForm($form, $form_state);
$this->configuration['negate'] = TRUE;
}
public function evaluate() {
$this->configuration['negate'] = TRUE;
$pages = mb_strtolower($this->configuration['pages']);
if (!$pages) {
return FALSE;
}
return parent::evaluate();
}
}