function CurrentDateContext::getRuntimeContexts

Overrides ContextProviderInterface::getRuntimeContexts

1 call to CurrentDateContext::getRuntimeContexts()
CurrentDateContext::getAvailableContexts in src/ContextProvider/CurrentDateContext.php
Gets all available contexts for the purposes of configuration.

File

src/ContextProvider/CurrentDateContext.php, line 37

Class

CurrentDateContext
Sets the current node as a context on node routes.

Namespace

Drupal\rules\ContextProvider

Code

public function getRuntimeContexts(array $unqualified_context_ids) {
    $datetime = $this->datetime
        ->getCurrentTime();
    $context_definition = new ContextDefinition('timestamp', $this->t('Current date'));
    $context = new Context($context_definition, $datetime);
    $result = [
        'current_date' => $context,
    ];
    return $result;
}