You are here

protected function Geolocation::prepareValues in Geolocation Field 8.3

Same name and namespace in other branches
  1. 8.2 src/Feeds/Target/Geolocation.php \Drupal\geolocation\Feeds\Target\Geolocation::prepareValues()

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

Parameters

array $values: The values.

Overrides FieldTargetBase::prepareValues

File

src/Feeds/Target/Geolocation.php, line 59

Class

Geolocation
Defines a geolocation field mapper.

Namespace

Drupal\geolocation\Feeds\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.
      \Drupal::messenger()
        ->addError($e
        ->getMessage());
    }
  }
  return $return;
}