You are here

protected function FieldTargetBase::prepareValues in Feeds 8.3

Prepares the the values that will be mapped to an entity.

Parameters

array $values: The values.

3 calls to FieldTargetBase::prepareValues()
FeedsItem::setTarget in src/Feeds/Target/FeedsItem.php
Sets the values on an object.
FieldTargetBase::setTarget in src/Plugin/Type/Target/FieldTargetBase.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 152

Class

FieldTargetBase
Helper class for field mappers.

Namespace

Drupal\feeds\Plugin\Type\Target

Code

protected function prepareValues(array $values) {
  $return = [];
  foreach ($values as $delta => $columns) {
    try {
      $this
        ->prepareValue($delta, $columns);
      $return[] = $columns;
    } catch (EmptyFeedException $e) {

      // Nothing wrong here.
    } catch (TargetValidationException $e) {

      // Validation failed.
      $this
        ->addMessage($e
        ->getFormattedMessage(), 'error');
    }
  }
  return $return;
}