tmgmt_node.module 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /**
  3. * @file
  4. * Source plugin for the Translation Management system that handles nodes.
  5. */
  6. /**
  7. * Implements hook_tmgmt_source_plugin_info().
  8. */
  9. function tmgmt_node_tmgmt_source_plugin_info() {
  10. $info['node'] = array(
  11. 'label' => t('Node'),
  12. 'description' => t('Source handler for nodes.'),
  13. 'plugin controller class' => 'TMGMTNodeSourcePluginController',
  14. 'ui controller class' => 'TMGMTNodeSourceUIController',
  15. 'views controller class' => 'TMGMTNodeSourceViewsController',
  16. 'item types' => array(),
  17. );
  18. foreach (node_type_get_names() as $type => $name) {
  19. if (translation_supported_type($type)) {
  20. $info['node']['item types'][$type] = $name;
  21. }
  22. }
  23. return $info;
  24. }
  25. /**
  26. * Form element validator for the missing target language views field handler.
  27. */
  28. function tmgmt_node_views_exposed_target_language_validate($form, &$form_state) {
  29. if (!empty($form_state['values']['tmgmt_node_missing_translation']) && $form_state['values']['language_1'] == $form_state['values']['tmgmt_node_missing_translation']) {
  30. form_set_error('tmgmt_node_missing_translation', t('The source and target languages must not be the same.'));
  31. }
  32. }