You are here

public function PatternSourceBase::getContextProperty in UI Patterns 8

Get context property value, if any.

Parameters

string $name: Context property name.

Return value

mixed Context property value.

Overrides PatternSourceInterface::getContextProperty

4 calls to PatternSourceBase::getContextProperty()
DsFieldSource::getSourceFields in modules/ui_patterns_ds/src/Plugin/UiPatterns/Source/DsFieldSource.php
Return list of source fields.
DsFieldTemplateSource::getSourceFields in modules/ui_patterns_ds/src/Plugin/UiPatterns/Source/DsFieldTemplateSource.php
Return list of source fields.
FieldSource::getSourceFields in src/Plugin/UiPatterns/Source/FieldSource.php
Return list of source fields.
ViewsRowSource::getSourceFields in modules/ui_patterns_views/src/Plugin/UiPatterns/Source/ViewsRowSource.php
Return list of source fields.

File

src/Plugin/PatternSourceBase.php, line 52

Class

PatternSourceBase
Base class for UI Patterns Source plugins.

Namespace

Drupal\ui_patterns\Plugin

Code

public function getContextProperty($name) {
  $configuration = $this
    ->getConfiguration();
  if (isset($configuration['context'][$name]) && !empty($configuration['context'][$name])) {
    return $configuration['context'][$name];
  }
  $reflection = new \ReflectionClass($this);
  $message = sprintf("Context property '%s' from %s is missing or empty.", $name, $reflection->name);
  throw new PluginException($message);
}