class ProcessingContext in YAML Content 8
The contextual data for content being actively loaded.
Hierarchy
- class \Drupal\yaml_content\Plugin\ProcessingContext
Expanded class hierarchy of ProcessingContext
7 files declare their use of ProcessingContext
- ContentLoader.php in src/
ContentLoader/ ContentLoader.php - File.php in src/
Plugin/ yaml_content/ process/ File.php - FileTest.php in tests/
src/ Functional/ Plugin/ yaml_content/ process/ FileTest.php - FileTest.php in tests/
src/ Unit/ Plugin/ yaml_content/ process/ FileTest.php - Reference.php in src/
Plugin/ yaml_content/ process/ Reference.php
File
- src/
Plugin/ ProcessingContext.php, line 11
Namespace
Drupal\yaml_content\PluginView source
class ProcessingContext {
/**
* The field currently being processed.
*
* @var \Drupal\Core\Field\FieldItemListInterface
*/
protected $field;
/**
* The active content loader instance.
*
* @var \Drupal\yaml_content\ContentLoader\ContentLoaderInterface
*/
protected $contentLoader;
/**
* Set the field context.
*
* @param \Drupal\Core\Field\FieldItemListInterface $field
* The field currently being processed.
*/
public function setField(FieldItemListInterface $field) {
$this->field = $field;
}
/**
* Get the field context.
*
* @return \Drupal\Core\Field\FieldItemListInterface
* The field currently being processed.
*/
public function getField() {
if (!isset($this->field)) {
// @todo Impelment a more specific exception.
throw new \Exception('Missing field context.');
}
return $this->field;
}
/**
* Set the content loader context.
*
* @param \Drupal\yaml_content\ContentLoader\ContentLoaderInterface $contentLoader
* The content loader instance actively loading content.
*/
public function setContentLoader(ContentLoaderInterface $contentLoader) {
$this->contentLoader = $contentLoader;
}
/**
* Get the content loader context.
*
* @return \Drupal\yaml_content\ContentLoader\ContentLoaderInterface
* The content loader instance actively loading content.
*/
public function getContentLoader() {
if (!isset($this->contentLoader)) {
// @todo Impelment a more specific exception.
throw new \Exception('Missing content loader context.');
}
return $this->contentLoader;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ProcessingContext:: |
protected | property | The active content loader instance. | |
ProcessingContext:: |
protected | property | The field currently being processed. | |
ProcessingContext:: |
public | function | Get the content loader context. | |
ProcessingContext:: |
public | function | Get the field context. | |
ProcessingContext:: |
public | function | Set the content loader context. | |
ProcessingContext:: |
public | function | Set the field context. |