trait DataProcessorManagerTrait

Trait for easily using the data processor service.

Hierarchy

See also

\Drupal\rules\Context\DataProcessorManager

1 file declares its use of DataProcessorManagerTrait
ContextFormTrait.php in src/Context/Form/ContextFormTrait.php

File

src/Context/DataProcessorManagerTrait.php, line 10

Namespace

Drupal\rules\Context
View source
trait DataProcessorManagerTrait {
    
    /**
     * The data processor manager.
     *
     * @var \Drupal\rules\Context\DataProcessorManager
     */
    protected $dataProcessorManager;
    
    /**
     * Sets the data processor manager.
     *
     * @param \Drupal\rules\Context\DataProcessorManager $dataProcessorManager
     *   The data processor manager.
     *
     * @return $this
     */
    public function setDataProcessorManager(DataProcessorManager $dataProcessorManager) {
        $this->dataProcessorManager = $dataProcessorManager;
        return $this;
    }
    
    /**
     * Gets the data processor manager.
     *
     * @return \Drupal\rules\Context\DataProcessorManager
     *   The data processor manager.
     */
    public function getDataProcessorManager() {
        if (empty($this->dataProcessorManager)) {
            $this->dataProcessorManager = \Drupal::service('plugin.manager.rules_data_processor');
        }
        return $this->dataProcessorManager;
    }

}

Members

Title Sort descending Modifiers Object type Summary
DataProcessorManagerTrait::$dataProcessorManager protected property The data processor manager.
DataProcessorManagerTrait::getDataProcessorManager public function Gets the data processor manager.
DataProcessorManagerTrait::setDataProcessorManager public function Sets the data processor manager.