public function FieldPropertiesSource::getSourceFields in UI Patterns Field Formatters 8
Return list of source fields.
Return value
\Drupal\ui_patterns\Definition\PatternSourceField[] List of source fields.
Overrides PatternSourceInterface::getSourceFields
File
- src/
Plugin/ UiPatterns/ Source/ FieldPropertiesSource.php, line 23
Class
- FieldPropertiesSource
- Defines Field values source plugin.
Namespace
Drupal\ui_patterns_field_formatters\Plugin\UiPatterns\SourceCode
public function getSourceFields() {
$sources = [];
$storageDefinition = $this
->getContextProperty('storageDefinition');
$fields = $storageDefinition
->getPropertyNames();
foreach ($fields as $field) {
if (!$this
->getContextProperty('limit')) {
$sources[] = $this
->getSourceField($field, $storageDefinition
->getPropertyDefinition($field)
->getLabel());
}
elseif (in_array($field, $this
->getContextProperty('limit'))) {
$sources[] = $this
->getSourceField($field, $storageDefinition
->getPropertyDefinition($field)
->getLabel());
}
}
return $sources;
}