You are here

public function MessageType::evaluate in Better Messages 8

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/MessageType.php, line 71

Class

MessageType
Provides a 'Message type' condition.

Namespace

Drupal\better_messages\Plugin\Condition

Code

public function evaluate() {
  $messages = $this
    ->getContextValue('better_messages');
  $intersect = array_intersect($this->configuration['message_types'], array_keys($messages));
  return empty($this->configuration['message_types']) || !empty($intersect);
}