abstract class ParserIcalFeeds in iCal feed parser 7.2
Parent class for Feeds integration.
Hierarchy
- class \ParserIcalFeeds extends \FeedsParser
Expanded class hierarchy of ParserIcalFeeds
1 string reference to 'ParserIcalFeeds'
- parser_ical_feeds_plugins in ./
parser_ical.module - Implementation of ctools plugin for feeds hook_feeds_plugins().
File
- includes/
ParserIcal.inc, line 10
View source
abstract class ParserIcalFeeds extends FeedsParser {
/**
* The output sources the parser offers.
*
* array(
* 'feeds_output_key' => array(
* 'name' => 'Human readable name of output source.',
* 'description' => 'Longer description of source.',
* 'parser_ical_handler' => 'Method callback for parsing source before handing to feeds.',
* ),
* );
*/
protected static $sources;
/**
* Implementation of FeedsParser::getMappingSources().
*/
public function getMappingSources() {
// Quirky work around.
// Want to have the sources as a property of the class,
// but can't declare them with t().
$sources = $this::$sources;
foreach ($sources as $key => &$value) {
if ($key == 'name' || $key == 'description') {
$value = t($value);
}
}
// parent::getMappingSources() triggers target creation too.
return $sources + parent::getMappingSources();
}
/**
* Override FeedsParser::getSourceElement().
*/
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);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ParserIcalFeeds:: |
protected static | property | The output sources the parser offers. | 2 |
ParserIcalFeeds:: |
public | function | Implementation of FeedsParser::getMappingSources(). | |
ParserIcalFeeds:: |
public | function | Override FeedsParser::getSourceElement(). |