migrate_ui.module 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. define('MIGRATE_ACCESS_BASIC', 'migration information');
  3. function migrate_ui_help($path, $arg) {
  4. switch ($path) {
  5. case 'admin/migrate':
  6. return t('The current status of each migration defined in this system. Click on a migration name for details on its configuration.');
  7. }
  8. }
  9. /**
  10. * Implementation of hook_permission().
  11. */
  12. function migrate_ui_permission() {
  13. return array(
  14. MIGRATE_ACCESS_BASIC => array(
  15. 'title' => t('Basic access to migration information'),
  16. ),
  17. );
  18. }
  19. /**
  20. * Implementation of hook_menu().
  21. */
  22. function migrate_menu() {
  23. $items = array();
  24. $items['admin/content/migrate'] = array(
  25. 'title' => 'Migrate',
  26. 'type' => MENU_LOCAL_TASK | MENU_NORMAL_ITEM,
  27. 'description' => 'Monitor the creation of Drupal content from source data',
  28. 'page callback' => 'migrate_ui_dashboard',
  29. 'access arguments' => array(MIGRATE_ACCESS_BASIC),
  30. 'file' => 'migrate_ui/migrate_ui.pages.inc',
  31. );
  32. $items['admin/content/migrate/dashboard'] = array(
  33. 'title' => 'Migrate',
  34. 'type' => MENU_DEFAULT_LOCAL_TASK,
  35. 'weight' => -10,
  36. );
  37. $items['admin/content/migrate/configure'] = array(
  38. 'title' => 'Configure',
  39. 'type' => MENU_LOCAL_TASK,
  40. 'description' => 'Configure migration handlers',
  41. 'page callback' => 'migrate_ui_configure',
  42. 'access arguments' => array(MIGRATE_ACCESS_BASIC),
  43. 'file' => 'migrate_ui/migrate_ui.pages.inc',
  44. 'weight' => 10,
  45. );
  46. $items['admin/content/migrate/messages/%migration'] = array(
  47. 'title callback' => 'migration_title',
  48. 'title arguments' => array(4),
  49. 'description' => 'View messages from a migration',
  50. 'page callback' => 'migrate_ui_messages',
  51. 'page arguments' => array(4),
  52. 'access arguments' => array(MIGRATE_ACCESS_BASIC),
  53. 'file' => 'migrate_ui/migrate_ui.pages.inc',
  54. );
  55. $items['admin/content/migrate/%migration'] = array(
  56. 'title callback' => 'migration_title',
  57. 'title arguments' => array(3),
  58. 'page callback' => 'drupal_get_form',
  59. 'page arguments' => array('migrate_migration_info', 3),
  60. 'access arguments' => array(MIGRATE_ACCESS_BASIC),
  61. 'file' => 'migrate_ui/migrate_ui.pages.inc',
  62. );
  63. if (FALSE) {
  64. // Not working yet
  65. migrate_ui_menu_add($items);
  66. }
  67. return $items;
  68. }
  69. // A menu load callback.
  70. function migration_load($machine_name) {
  71. if ($machine_name) {
  72. return Migration::getInstance($machine_name);
  73. }
  74. }
  75. function migration_title($migration) {
  76. if (is_string($migration)) {
  77. $migration = migration_load($migration);
  78. }
  79. return $migration->getMachineName();
  80. }