You are here

protected function SmartDate::prepareValues in Smart Date 8.2

Same name and namespace in other branches
  1. 3.x src/Feeds/Target/SmartDate.php \Drupal\smart_date\Feeds\Target\SmartDate::prepareValues()
  2. 3.0.x src/Feeds/Target/SmartDate.php \Drupal\smart_date\Feeds\Target\SmartDate::prepareValues()
  3. 3.1.x src/Feeds/Target/SmartDate.php \Drupal\smart_date\Feeds\Target\SmartDate::prepareValues()
  4. 3.2.x src/Feeds/Target/SmartDate.php \Drupal\smart_date\Feeds\Target\SmartDate::prepareValues()
  5. 3.3.x src/Feeds/Target/SmartDate.php \Drupal\smart_date\Feeds\Target\SmartDate::prepareValues()
  6. 3.4.x src/Feeds/Target/SmartDate.php \Drupal\smart_date\Feeds\Target\SmartDate::prepareValues()

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

Parameters

array $values: The values.

Overrides FieldTargetBase::prepareValues

File

src/Feeds/Target/SmartDate.php, line 48

Class

SmartDate
Defines a smartdate field mapper.

Namespace

Drupal\smart_date\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;
}