tmgmt.ui.source.inc 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <?php
  2. /**
  3. * Default ui controller class for source plugin.
  4. *
  5. * @ingroup tmgmt_source
  6. */
  7. class TMGMTDefaultSourceUIController extends TMGMTPluginBase implements TMGMTSourceUIControllerInterface {
  8. /**
  9. * {@inheritdoc}
  10. */
  11. public function reviewForm($form, &$form_state, TMGMTJobItem $item) {
  12. return $form;
  13. }
  14. /**
  15. * {@inheritdoc}
  16. */
  17. public function reviewDataItemElement($form, &$form_state, $data_item_key, $parent_key, array $data_item, TMGMTJobItem $item) {
  18. return $form;
  19. }
  20. /**
  21. * {@inheritdoc}
  22. */
  23. public function reviewFormValidate($form, &$form_state, TMGMTJobItem $item) {
  24. // Nothing to do here by default.
  25. }
  26. /**
  27. * {@inheritdoc}
  28. */
  29. public function reviewFormSubmit($form, &$form_state, TMGMTJobItem $item) {
  30. // Nothing to do here by default.
  31. }
  32. /**
  33. * {@inheritdoc}
  34. */
  35. public function overviewForm($form, &$form_state, $type) {
  36. return $form;
  37. }
  38. /**
  39. * {@inheritdoc}
  40. */
  41. public function overviewFormValidate($form, &$form_state, $type) {
  42. // Nothing to do here by default.
  43. }
  44. /**
  45. * {@inheritdoc}
  46. */
  47. public function overviewFormSubmit($form, &$form_state, $type) {
  48. // Nothing to do here by default.
  49. }
  50. /**
  51. * {@inheritdoc}
  52. */
  53. public function hook_menu() {
  54. $items = array();
  55. if ($types = tmgmt_source_translatable_item_types($this->pluginType)) {
  56. $defaults = array(
  57. 'page callback' => 'drupal_get_form',
  58. 'access callback' => 'tmgmt_job_access',
  59. 'access arguments' => array('create'),
  60. );
  61. if (isset($this->pluginInfo['file'])) {
  62. $defaults['file'] = $this->pluginInfo['file'];
  63. }
  64. if (isset($this->pluginInfo['file path'])) {
  65. $defaults['file path'] = $this->pluginInfo['file path'];
  66. }
  67. foreach ($types as $type => $name) {
  68. $items['admin/tmgmt/sources/' . $this->pluginType . '_' . $type] = $defaults + array(
  69. 'title' => check_plain($name),
  70. 'page arguments' => array('tmgmt_ui_' . $this->pluginType . '_source_' . $type . '_overview_form', $this->pluginType, $type),
  71. 'type' => MENU_LOCAL_TASK,
  72. );
  73. }
  74. }
  75. return $items;
  76. }
  77. /**
  78. * {@inheritdoc}
  79. */
  80. public function hook_forms() {
  81. $info = array();
  82. if ($types = tmgmt_source_translatable_item_types($this->pluginType)) {
  83. foreach (array_keys($types) as $type) {
  84. $info['tmgmt_ui_' . $this->pluginType . '_source_' . $type . '_overview_form'] = array(
  85. 'callback' => 'tmgmt_ui_source_overview_form',
  86. 'wrapper_callback' => 'tmgmt_ui_source_overview_form_defaults',
  87. );
  88. }
  89. }
  90. return $info;
  91. }
  92. /**
  93. * {@inheritdoc}
  94. */
  95. public function hook_views_default_views() {
  96. return array();
  97. }
  98. }