You are here

protected function FeedsExBase::executeSources in Feeds extensible parsers 7

Same name and namespace in other branches
  1. 7.2 src/FeedsExBase.inc \FeedsExBase::executeSources()

Executes the source expressions.

Parameters

mixed $row: A single item returned from the context expression.

array $expressions: A map of machine name to expression.

array $variable_map: A map of machine name to varible name.

Return value

array The fully-parsed item array.

3 calls to FeedsExBase::executeSources()
FeedsExBase::parseItems in src/FeedsExBase.inc
Performs the actual parsing.
FeedsExJmesPathLines::parseItems in src/FeedsExJmesPathLines.inc
Performs the actual parsing.
FeedsExJsonPathLines::parseItems in src/FeedsExJsonPathLines.inc
Performs the actual parsing.

File

src/FeedsExBase.inc, line 287
Contains FeedsExBase.

Class

FeedsExBase
The Feeds extensible parser.

Code

protected function executeSources($row, array $expressions, array $variable_map) {
  $item = array();
  $variables = array();
  foreach ($expressions as $machine_name => $expression) {

    // Variable substitution.
    $expression = strtr($expression, $variables);
    $result = $this
      ->executeSourceExpression($machine_name, $expression, $row);
    if (!empty($this->config['sources'][$machine_name]['debug'])) {
      $this
        ->debug($result, $machine_name);
    }
    if ($result === NULL) {
      $variables[$variable_map[$machine_name]] = '';
      continue;
    }
    $item[$machine_name] = $result;
    $variables[$variable_map[$machine_name]] = is_array($result) ? reset($result) : $result;
  }
  return $item;
}