Created
August 9, 2010 16:48
-
-
Save investic/515693 to your computer and use it in GitHub Desktop.
Parser para json para el modulo feeds de drupal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
/** | |
* A parser for the Sitemap specification http://www.sitemaps.org/protocol.php | |
*/ | |
class HontzafeedsParser extends FeedsParser { | |
public function parse(FeedsImportBatch $batch, FeedsSource $source) { | |
$string = $batch->getRaw(); | |
$json = json_decode($string); | |
drupal_set_message(dprint_r($json,1)); | |
$arrs = $json->query->results->item; | |
$batch->setItems($items); | |
} | |
/** | |
* Implementation of FeedsParser::getMappingSources(). | |
*/ | |
public function getMappingSources() { | |
return array( | |
'title' => array( | |
'name' => t('titulo'), | |
'description' => t('titulo'), | |
), | |
'description' => array( | |
'name' => t('descripcion'), | |
'description' => 'Esto es una descripcion', | |
), | |
'link' => array( | |
'name' => t('link'), | |
'descripcion' => 'Link del item', | |
), | |
'guid' => array( | |
'name' => t('guid'), | |
'descripcion' => 'guid del item', | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment