Skip to content

Instantly share code, notes, and snippets.

@investic
Created August 9, 2010 16:48
Show Gist options
  • Save investic/515693 to your computer and use it in GitHub Desktop.
Save investic/515693 to your computer and use it in GitHub Desktop.
Parser para json para el modulo feeds de drupal
<?
/**
* 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