public function FieldTargetBase::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 TargetInterface::setTarget
4 methods override FieldTargetBase::setTarget()
- ConfigEntityReference::setTarget in src/
Feeds/ Target/ ConfigEntityReference.php - Sets the values on an object.
- EntityReference::setTarget in src/
Feeds/ Target/ EntityReference.php - Sets the values on an object.
- FeedsItem::setTarget in src/
Feeds/ Target/ FeedsItem.php - Sets the values on an object.
- Language::setTarget in src/
Feeds/ Target/ Language.php - Sets the values on an object.
File
- src/
Plugin/ Type/ Target/ FieldTargetBase.php, line 91
Class
- FieldTargetBase
- Helper class for field mappers.
Namespace
Drupal\feeds\Plugin\Type\TargetCode
public function setTarget(FeedInterface $feed, EntityInterface $entity, $field_name, array $values) {
if ($values = $this
->prepareValues($values)) {
$entity_target = $this
->getEntityTarget($feed, $entity);
if (!empty($entity_target)) {
$item_list = $entity_target
->get($field_name);
// Append these values to the existing values.
$values = array_merge($item_list
->getValue(), $values);
$item_list
->setValue($values);
}
}
}