public function FeedsItem::setTarget in Feeds 8.3
Sets the values on an object.
Parameters
\Drupal\feeds\FeedInterface $feed: The feed object.
\Drupal\Core\Entity\EntityInterface $entity: The target object.
string $target: The name of the target to set.
array $values: A list of values to set on the target.
Overrides FieldTargetBase::setTarget
File
- src/
Feeds/ Target/ FeedsItem.php, line 35
Class
- FeedsItem
- Defines a feeds_item field mapper.
Namespace
Drupal\feeds\Feeds\TargetCode
public function setTarget(FeedInterface $feed, EntityInterface $entity, $field_name, array $values) {
if ($values = $this
->prepareValues($values)) {
$entity_target = $this
->getEntityTarget($feed, $entity);
$item_list = $entity_target
->get($field_name);
// Append these values to the existing values.
$values = array_merge($item_list
->getValue()[0], $values[0]);
$item_list
->setValue($values);
}
}