function EntityContextDefinition::toArray

Overrides ContextDefinitionInterface::toArray

File

src/Context/EntityContextDefinition.php, line 59

Class

EntityContextDefinition
Extends the core entity context definition class with useful methods.

Namespace

Drupal\rules\Context

Code

public function toArray() {
    $values = [];
    $defaults = get_class_vars(__CLASS__);
    foreach (static::$nameMap as $key => $property_name) {
        // Only export values for non-default properties.
        if ($this->{$property_name} !== $defaults[$property_name]) {
            $values[$key] = $this->{$property_name};
        }
    }
    return $values;
}