function ContextConfig::map

Maps the data specified by the selector to the given context.

Parameters

string $context_name: The name of the context.

string $property_path: A valid property path; e.g., "node.uid.target_id".

Return value

$this

Throws

\Drupal\rules\Exception\LogicException Thrown if a context value and map are set for a given context at the same time.

File

src/Context/ContextConfig.php, line 65

Class

ContextConfig
Class for value objects helping with context configuration.

Namespace

Drupal\rules\Context

Code

public function map($context_name, $property_path) {
    if (isset($this->config['context_values'][$context_name])) {
        throw new LogicException("Cannot map a context value and pre-define it at the same time.");
    }
    $this->config['context_mapping'][$context_name] = $property_path;
    return $this;
}