trait PlaceholderResolverTrait in Typed Data API enhancements 8
Helper for classes that need the placeholder resolver.
Hierarchy
- trait \Drupal\typed_data\PlaceholderResolverTrait
File
- src/
PlaceholderResolverTrait.php, line 8
Namespace
Drupal\typed_dataView source
trait PlaceholderResolverTrait {
/**
* The placeholder resolver.
*
* @var \Drupal\typed_data\PlaceholderResolverInterface
*/
protected $placeholderResolver;
/**
* Sets the placeholder resolver.
*
* @param \Drupal\typed_data\PlaceholderResolverInterface $placeholder_resolver
* The placeholder resolver.
*
* @return $this
*/
public function setPlaceholderResolver(PlaceholderResolverInterface $placeholder_resolver) {
$this->placeholderResolver = $placeholder_resolver;
return $this;
}
/**
* Gets the placeholder resolver.
*
* @return \Drupal\typed_data\PlaceholderResolverInterface
* The placeholder resolver.
*/
public function getPlaceholderResolver() {
if (empty($this->placeholderResolver)) {
$this->placeholderResolver = \Drupal::service('typed_data.placeholder_resolver');
}
return $this->placeholderResolver;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PlaceholderResolverTrait:: |
protected | property | The placeholder resolver. | |
PlaceholderResolverTrait:: |
public | function | Gets the placeholder resolver. | |
PlaceholderResolverTrait:: |
public | function | Sets the placeholder resolver. |