You are here

public function ParserIcalFeeds::getSourceElement in iCal feed parser 7.2

Override FeedsParser::getSourceElement().

File

includes/ParserIcal.inc, line 44

Class

ParserIcalFeeds
Parent class for Feeds integration.

Code

public function getSourceElement(FeedsSource $source, FeedsParserResult $result, $property_key) {

  // Allow parent method to handle any mappings based on the parent node.
  if (substr($property_key, 0, 7) == 'parent:') {
    return parent::getSourceElement($source, $result, $property_key);
  }

  // Otherwise retrieve the current ParserIcalCreatorComponent
  // from the ParserIcalResult
  if ($item = $result
    ->currentItem()) {
    if ($position = strpos($property_key, ':')) {
      $key = substr($property_key, 0, $position);
      $attribute = substr($property_key, ++$position);
    }
    else {
      $key = $property_key;
    }

    // and use listed handler to get source output
    $handler = $this::$sources[$property_key]['parser_ical_handler'];
    $property = $item
      ->getProperty($key);
    return $this
      ->{$handler}($property_key, $property, $item, $result, $source);
  }
}