public function BasicFieldSource::getSourceElement in Feeds 8.3
@todo I guess we could cache this since the value will be the same for source/feed id combo.
Overrides SourceInterface::getSourceElement
File
- src/
Feeds/ Source/ BasicFieldSource.php, line 43
Class
- BasicFieldSource
- A source plugin that provides feed type fields as mapping sources.
Namespace
Drupal\feeds\Feeds\SourceCode
public function getSourceElement(FeedInterface $feed, ItemInterface $item) {
list(, $field_name) = explode(':', $this->configuration['source']);
$return = [];
if ($field_list = $feed
->get($field_name)) {
foreach ($field_list as $field) {
$main_property_name = $field
->getFieldDefinition()
->getFieldStorageDefinition()
->getMainPropertyName();
if ($main_property_name) {
$return[] = $field->{$main_property_name};
}
}
}
return $return;
}