You are here

public function ModuleEnabled::evaluate in Varbase Total Control Dashboard 8.6

Same name and namespace in other branches
  1. 8 src/Plugin/Condition/ModuleEnabled.php \Drupal\varbase_total_control\Plugin\Condition\ModuleEnabled::evaluate()
  2. 8.5 src/Plugin/Condition/ModuleEnabled.php \Drupal\varbase_total_control\Plugin\Condition\ModuleEnabled::evaluate()
  3. 9.0.x src/Plugin/Condition/ModuleEnabled.php \Drupal\varbase_total_control\Plugin\Condition\ModuleEnabled::evaluate()

Evaluates the condition and returns TRUE or FALSE accordingly.

Return value

bool TRUE if the condition has been met, FALSE otherwise.

Overrides ConditionInterface::evaluate

File

src/Plugin/Condition/ModuleEnabled.php, line 66

Class

ModuleEnabled
Provides a 'Module' condition.

Namespace

Drupal\varbase_total_control\Plugin\Condition

Code

public function evaluate() {
  if (!trim($this->configuration['module'])) {
    return TRUE;
  }
  $moduleHandler = \Drupal::service('module_handler');
  return (bool) $moduleHandler
    ->moduleExists($this->configuration['module']);
}