You are here

README.txt in Feed Import 7.3

FEED IMPORT

Project page: https://drupal.org/project/feed_import

This module only provides an UI for Feed Import Base module.
Checkout the examples of how to use this UI https://drupal.org/node/2190315

Hooks
-----------

For examples, check feed_import.module file.

To register new settings:

function hook_feed_import_setting_types() {
  return array(
    'setting-name' => array(
      'hook' => 'hook_to_invoke',
      'base' => 'BaseClass',
    );
  );
}

To register a reader:

function hook_feed_import_reader_info() {
  return array(
    'my_reader' => array(
      // Reader name
      'name' => t('Reader name'),
      // Reader description
      'description' => t('Description'),
      // If you want to extend other reader and use its options you can specify
      // here the name of parent reader. You can reorder options using #wight,
      // you can remove options by setting it to false, you can change it by
      // adding properties to options or you can add new options.
      'inherit_options' => 'processor name or FALSE if no options are inherited',
      // The class that handles this reader (extending FeedImportReader)
      'class' => 'ReaderNameClass',
      // Options are form elements which must have a default value
      'options' => array(
        'option1' => array(
          '#type' => 'textfield',
          '#title' => t('Option1'),
          '#description' => t('Description 1'),
          '#default_value' => '1',
          '#required' => TRUE,
          '#maxlength' => 1024,
          // validate option by using #element_validate
          '#element_validate' => array('my_element_validate_function'),
        ),
        'optionx' => array(
          '#type' => 'textarea',
          '#title' => t('Option X)'),
          '#description' => t('Description of X'),
          '#default_value' => '',
        ),
        // Other options
      )
    ),
  );
}

To register a new processor:

function hook_feed_import_processor_info() {
  // similar to hook_feed_import_reader_info().
}

To register a new hash manager:

function hook_feed_import_hash_manager_info() {
  // similar to hook_feed_import_reader_info().
}

To register a new filter handler:

function hook_feed_import_filter_info() {
  // similar to hook_feed_import_reader_info().
}

File

README.txt
View source
  1. FEED IMPORT
  2. Project page: https://drupal.org/project/feed_import
  3. This module only provides an UI for Feed Import Base module.
  4. Checkout the examples of how to use this UI https://drupal.org/node/2190315
  5. Hooks
  6. -----------
  7. For examples, check feed_import.module file.
  8. To register new settings:
  9. function hook_feed_import_setting_types() {
  10. return array(
  11. 'setting-name' => array(
  12. 'hook' => 'hook_to_invoke',
  13. 'base' => 'BaseClass',
  14. );
  15. );
  16. }
  17. To register a reader:
  18. function hook_feed_import_reader_info() {
  19. return array(
  20. 'my_reader' => array(
  21. // Reader name
  22. 'name' => t('Reader name'),
  23. // Reader description
  24. 'description' => t('Description'),
  25. // If you want to extend other reader and use its options you can specify
  26. // here the name of parent reader. You can reorder options using #wight,
  27. // you can remove options by setting it to false, you can change it by
  28. // adding properties to options or you can add new options.
  29. 'inherit_options' => 'processor name or FALSE if no options are inherited',
  30. // The class that handles this reader (extending FeedImportReader)
  31. 'class' => 'ReaderNameClass',
  32. // Options are form elements which must have a default value
  33. 'options' => array(
  34. 'option1' => array(
  35. '#type' => 'textfield',
  36. '#title' => t('Option1'),
  37. '#description' => t('Description 1'),
  38. '#default_value' => '1',
  39. '#required' => TRUE,
  40. '#maxlength' => 1024,
  41. // validate option by using #element_validate
  42. '#element_validate' => array('my_element_validate_function'),
  43. ),
  44. 'optionx' => array(
  45. '#type' => 'textarea',
  46. '#title' => t('Option X)'),
  47. '#description' => t('Description of X'),
  48. '#default_value' => '',
  49. ),
  50. // Other options
  51. )
  52. ),
  53. );
  54. }
  55. To register a new processor:
  56. function hook_feed_import_processor_info() {
  57. // similar to hook_feed_import_reader_info().
  58. }
  59. To register a new hash manager:
  60. function hook_feed_import_hash_manager_info() {
  61. // similar to hook_feed_import_reader_info().
  62. }
  63. To register a new filter handler:
  64. function hook_feed_import_filter_info() {
  65. // similar to hook_feed_import_reader_info().
  66. }