tmgmt.plugin.source.inc 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * @file
  4. * Contains the abstract source base plugin class.
  5. */
  6. /**
  7. * Default controller class for source plugins.
  8. *
  9. * @ingroup tmgmt_source
  10. */
  11. abstract class TMGMTDefaultSourcePluginController extends TMGMTPluginBase implements TMGMTSourcePluginControllerInterface {
  12. /**
  13. * {@inheritdoc}
  14. */
  15. public function getLabel(TMGMTJobItem $job_item) {
  16. return t('@plugin item unavailable (@item)', array('@plugin' => $this->pluginInfo['label'], '@item' => $job_item->item_type . ':' . $job_item->item_id));
  17. }
  18. /**
  19. * {@inheritdoc}
  20. */
  21. public function getUri(TMGMTJobItem $job_item) {
  22. return array(
  23. 'path' => '',
  24. 'options' => array(),
  25. );
  26. }
  27. /**
  28. * {@inheritdoc}
  29. */
  30. public function getItemTypes() {
  31. return isset($this->pluginInfo['item types']) ? $this->pluginInfo['item types'] : array();
  32. }
  33. /**
  34. * {@inheritdoc}
  35. */
  36. public function getItemTypeLabel($type) {
  37. $types = $this->getItemTypes();
  38. if (isset($types[$type])) {
  39. return $types[$type];
  40. }
  41. return '';
  42. }
  43. /**
  44. * {@inheritdoc}
  45. */
  46. public function getType(TMGMTJobItem $job_item) {
  47. return ucfirst($job_item->item_type);
  48. }
  49. /**
  50. * {@inheritdoc}
  51. */
  52. public function getExistingLangCodes(TMGMTJobItem $job_item) {
  53. return array();
  54. }
  55. }