You are here

public function EntityTranslationScaldHandler::entityForm in Scald: Media Management made easy 7

Tweaks the product form to support multilingual elements.

Overrides EntityTranslationDefaultHandler::entityForm

File

includes/scald.translation_handler.inc, line 35
Translation handler for the Scald Atom entity.

Class

EntityTranslationScaldHandler
Class implementing the entity translation behaviours for Scald Atom.

Code

public function entityForm(&$form, &$form_state) {
  parent::entityForm($form, $form_state);
  $translations = $this
    ->getTranslations();
  $is_translation = $this
    ->isTranslationForm();
  $form_langcode = $this
    ->getFormLanguage();
  $new_translation = !isset($translations->data[$form_langcode]);
  if ($is_translation && !$new_translation) {
    $form['actions']['delete_translation'] = array(
      '#type' => 'submit',
      '#value' => t('Delete translation'),
      '#weight' => 50,
      '#submit' => array(
        'entity_translation_entity_form_delete_translation_submit',
      ),
    );
  }
}