translation.handler.comment.inc 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * @file
  4. * Comment translation handler for the entity translation module.
  5. */
  6. /**
  7. * Comment translation handler.
  8. */
  9. class EntityTranslationCommentHandler extends EntityTranslationDefaultHandler {
  10. public function __construct($entity_type, $entity_info, $entity) {
  11. parent::__construct('comment', $entity_info, $entity);
  12. }
  13. /**
  14. * @see EntityTranslationDefaultHandler::entityForm()
  15. */
  16. public function entityForm(&$form, &$form_state) {
  17. parent::entityForm($form, $form_state);
  18. // Adjust the translation fieldset weight to move it below the admin one.
  19. $form['translation']['#weight'] = 1;
  20. }
  21. /**
  22. * @see EntityTranslationDefaultHandler::entityFormLanguageWidgetSubmit()
  23. */
  24. public function entityFormLanguageWidgetSubmit($form, &$form_state) {
  25. $this->updateFormLanguage($form_state);
  26. }
  27. /**
  28. * @see EntityTranslationDefaultHandler::entityFormTitle()
  29. */
  30. protected function entityFormTitle() {
  31. return t('Edit comment @subject', array('@subject' => $this->getLabel()));
  32. }
  33. /**
  34. * @see EntityTranslationDefaultHandler::getStatus()
  35. */
  36. protected function getStatus() {
  37. return (boolean) $this->entity->status;
  38. }
  39. }