You are here

EntityTranslationUnifiedFormTabbedMode.php in Entity Translation Unified Form 8

File

src/Plugin/EntityTranslationUnifiedFormMode/EntityTranslationUnifiedFormTabbedMode.php
View source
<?php

namespace Drupal\entity_translation_unified_form\Plugin\EntityTranslationUnifiedFormMode;

use Drupal\entity_translation_unified_form\EntityTranslationUnifiedFormModeInterface;

/**
 * @EntityTranslationUnifiedFormMode (
 *   id = "EntityTranslationUnifiedFormTabbedMode",
 *   admin_label = @Translation("Tabbed Mode"),
 * )
 */
class EntityTranslationUnifiedFormTabbedMode extends EntityTranslationUnifiedFormInlineMode implements EntityTranslationUnifiedFormModeInterface {
  public function fieldFormAlter($form, $form_state, &$field, $field_name, $language) {
    if ($field_name == 'path') {

      // path doesn't currently work well with tabs.
      // use the inline mode for now
      parent::alterTitle($form, $form_state, $field, $field_name, $language);
    }
    return;
  }
  public function getFieldGroupThemeWrapper($form, $form_state, $field, $field_name) {
    if ($field_name == 'path') {

      // path doesn't currently work well with tabs.
      // use the inline wrapper for now
      return 'entity_translation_unified_form__inline__wrapper';
    }
    return 'entity_translation_unified_form__a11y_accordion_tabs__wrapper';
  }
  public function getFieldThemeWrapper($form, $form_state, $field, $field_name, $language) {
    if ($field_name == 'path') {

      // path doesn't currently work well with tabs.
      // use the inline wrapper for now
      return 'entity_translation_unified_form__inline__field_wrapper';
    }
    return 'entity_translation_unified_form__a11y_accordion_tabs__field_wrapper';
  }

}

Classes

Namesort descending Description
EntityTranslationUnifiedFormTabbedMode @EntityTranslationUnifiedFormMode ( id = "EntityTranslationUnifiedFormTabbedMode", admin_label = Plugin annotation @Translation("Tabbed Mode"), )