public static function MediaTarget::targets in Media Feeds 8
Returns the targets defined by this plugin.
Parameters
\Drupal\feeds\TargetDefinitionInterface[] $targets: An array of targets.
\Drupal\feeds\FeedTypeInterface $feed_type: The feed type object.
array $definition: The plugin implementation definition.
Overrides FieldTargetBase::targets
File
- src/
Feeds/ Target/ MediaTarget.php, line 131
Class
- MediaTarget
- Defines a wrapper target around a paragraph bundle's target field.
Namespace
Drupal\media_feeds\Feeds\TargetCode
public static function targets(array &$targets, FeedTypeInterface $feed_type, array $definition) {
$processor = $feed_type
->getProcessor();
$entity_type = $processor
->entityType();
$bundle = $processor
->bundle();
$fields = self::getFields($entity_type, $bundle);
foreach ($fields as $field) {
self::prepareTarget($field);
if (isset($field->sub_fields)) {
$sub_fields = $field->sub_fields;
foreach ($sub_fields as $sub_field) {
$subFInstance = $sub_field
->getFieldDefinition();
$info = $subFInstance->media_feeds_info;
$id = $info['host']['field'] . "_" . $subFInstance
->getName();
$targets[$id] = $sub_field;
}
}
}
parent::targets($targets, $feed_type, $definition);
}