<?php
/**
 * @file
 * popsu_themes_local.feeds_importer_default.inc
 */

/**
 * Implements hook_feeds_importer_default().
 */
function popsu_themes_local_feeds_importer_default() {
  $export = array();

  $feeds_importer = new stdClass();
  $feeds_importer->disabled = FALSE; /* Edit this to true to make a default feeds_importer disabled initially */
  $feeds_importer->api_version = 1;
  $feeds_importer->id = 'popsu_popsu1_themloc_from_xml';
  $feeds_importer->config = array(
    'name' => 'POPSU 1 - Themes locaux from XML',
    'description' => 'Import de contenus Thèmes locaux pour POPSU 1 depuis des fichiers XML',
    'fetcher' => array(
      'plugin_key' => 'FeedsFileFetcher',
      'config' => array(
        'allowed_extensions' => 'txt csv tsv xml opml json html htm',
        'direct' => 0,
      ),
    ),
    'parser' => array(
      'plugin_key' => 'FeedsXPathParserXML',
      'config' => array(
        'sources' => array(
          'xpathparser:0' => 'column[@name=\'titre\']',
          'xpathparser:1' => 'column[@name=\'ville\']',
          'xpathparser:2' => 'column[@name=\'chapo\']',
          'xpathparser:3' => 'column[@name=\'texte\']',
        ),
        'rawXML' => array(
          'xpathparser:0' => 0,
          'xpathparser:1' => 0,
          'xpathparser:2' => 0,
          'xpathparser:3' => 0,
        ),
        'context' => '//table[@name=\'spip_articles\']',
        'exp' => array(
          'errors' => 1,
          'debug' => array(
            'context' => 0,
            'xpathparser:0' => 0,
            'xpathparser:1' => 0,
            'xpathparser:2' => 0,
            'xpathparser:3' => 0,
          ),
        ),
        'allow_override' => 1,
      ),
    ),
    'processor' => array(
      'plugin_key' => 'FeedsNodeProcessor',
      'config' => array(
        'content_type' => 'popsu_theme_local',
        'expire' => '-1',
        'author' => '1',
        'authorize' => 0,
        'mappings' => array(
          0 => array(
            'source' => 'xpathparser:0',
            'target' => 'title',
            'unique' => FALSE,
          ),
          1 => array(
            'source' => 'xpathparser:1',
            'target' => 'field_popsu_themloc_ville',
            'unique' => FALSE,
          ),
          2 => array(
            'source' => 'xpathparser:2',
            'target' => 'field_popsu_themloc_body',
            'unique' => FALSE,
          ),
          3 => array(
            'source' => 'xpathparser:3',
            'target' => 'field_popsu_themloc_demarche',
            'unique' => FALSE,
          ),
        ),
        'update_existing' => '0',
        'input_format' => 'php_code',
        'skip_hash_check' => 0,
      ),
    ),
    'content_type' => '',
    'update' => 0,
    'import_period' => '-1',
    'expire_period' => 3600,
    'import_on_create' => 1,
    'process_in_background' => 0,
  );
  $export['popsu_popsu1_themloc_from_xml'] = $feeds_importer;

  return $export;
}
