entityreference_feeds_test.module

  1. cis7 sites/all/modules/ulmus/entityreference/tests/modules/entityreference_feeds_test/entityreference_feeds_test.module
  2. cle7 sites/all/modules/ulmus/entityreference/tests/modules/entityreference_feeds_test/entityreference_feeds_test.module
  3. ecd7 sites/all/modules/ulmus/entityreference/tests/modules/entityreference_feeds_test/entityreference_feeds_test.module
  4. elmsmedia7 sites/all/modules/ulmus/entityreference/tests/modules/entityreference_feeds_test/entityreference_feeds_test.module
  5. harmony7 sites/all/modules/ulmus/entityreference/tests/modules/entityreference_feeds_test/entityreference_feeds_test.module
  6. icor7 sites/all/modules/ulmus/entityreference/tests/modules/entityreference_feeds_test/entityreference_feeds_test.module
  7. meedjum_blog7 sites/all/modules/ulmus/entityreference/tests/modules/entityreference_feeds_test/entityreference_feeds_test.module
  8. mooc7 sites/all/modules/ulmus/entityreference/tests/modules/entityreference_feeds_test/entityreference_feeds_test.module

Support module for Entity reference - Feeds integration.

Functions

File

sites/all/modules/ulmus/entityreference/tests/modules/entityreference_feeds_test/entityreference_feeds_test.module
View source
  1. <?php
  2. /**
  3. * @file
  4. * Support module for Entity reference - Feeds integration.
  5. */
  6. /**
  7. * Implements hook_install().
  8. */
  9. function entityreference_feeds_test_install() {
  10. field_info_cache_clear();
  11. // Entity reference field - mapped by ID.
  12. $field = array(
  13. 'field_name' => 'field_er_id',
  14. 'type' => 'entityreference',
  15. 'cardinality' => 1,
  16. 'settings' => array(
  17. 'target_type' => 'node',
  18. 'handler' => 'base',
  19. 'handler_settings' => array(
  20. 'target_bundles' => array('article' => 'article'),
  21. ),
  22. ),
  23. );
  24. field_create_field($field);
  25. $instance = array(
  26. 'field_name' => 'field_er_id',
  27. 'entity_type' => 'node',
  28. 'label' => 'Ref - entity ID',
  29. 'bundle' => 'article',
  30. );
  31. field_create_instance($instance);
  32. // Entity reference field - mapped by Feeds GUID.
  33. $field = array(
  34. 'field_name' => 'field_er_guid',
  35. 'type' => 'entityreference',
  36. 'cardinality' => 1,
  37. 'settings' => array(
  38. 'target_type' => 'node',
  39. 'handler' => 'base',
  40. 'handler_settings' => array(
  41. 'target_bundles' => array('article' => 'article'),
  42. ),
  43. ),
  44. );
  45. field_create_field($field);
  46. $instance = array(
  47. 'field_name' => 'field_er_guid',
  48. 'entity_type' => 'node',
  49. 'label' => 'Ref - feeds GUID',
  50. 'bundle' => 'article',
  51. );
  52. field_create_instance($instance);
  53. // Entity reference field - mapped by Feeds URL.
  54. $field = array(
  55. 'field_name' => 'field_er_url',
  56. 'type' => 'entityreference',
  57. 'cardinality' => 1,
  58. 'settings' => array(
  59. 'target_type' => 'node',
  60. 'handler' => 'base',
  61. 'handler_settings' => array(
  62. 'target_bundles' => array('article' => 'article'),
  63. ),
  64. ),
  65. );
  66. field_create_field($field);
  67. $instance = array(
  68. 'field_name' => 'field_er_url',
  69. 'entity_type' => 'node',
  70. 'label' => 'Ref - feeds URL',
  71. 'bundle' => 'article',
  72. );
  73. field_create_instance($instance);
  74. // Entity reference field - mapped by Label.
  75. $field = array(
  76. 'field_name' => 'field_er_label',
  77. 'type' => 'entityreference',
  78. 'cardinality' => 1,
  79. 'settings' => array(
  80. 'target_type' => 'node',
  81. 'handler' => 'base',
  82. 'handler_settings' => array(
  83. 'target_bundles' => array('article' => 'article'),
  84. ),
  85. ),
  86. );
  87. field_create_field($field);
  88. $instance = array(
  89. 'field_name' => 'field_er_label',
  90. 'entity_type' => 'node',
  91. 'label' => 'Ref - entity label',
  92. 'bundle' => 'article',
  93. );
  94. field_create_instance($instance);
  95. }