You are here

protected function ContentEntity::isTranslating in Commerce Core 8.2

Determines whether there's a translation in progress.

If the parent entity is being translated, then all inline entities are candidates for translating as well.

Parameters

\Drupal\Core\Form\FormStateInterface $form_state: The form state.

Return value

bool TRUE if translating is in progress, FALSE otherwise.

See also

\Drupal\Core\Entity\ContentEntityForm::initFormLangcodes()

1 call to ContentEntity::isTranslating()
ContentEntity::ensureTranslation in src/Plugin/Commerce/InlineForm/ContentEntity.php
Ensures the correct entity translation.

File

src/Plugin/Commerce/InlineForm/ContentEntity.php, line 182

Class

ContentEntity
Provides an inline form for managing a content entity.

Namespace

Drupal\commerce\Plugin\Commerce\InlineForm

Code

protected function isTranslating(FormStateInterface $form_state) {
  $form_langcode = $form_state
    ->get('langcode');
  $default_langcode = $form_state
    ->get('entity_default_langcode');
  return $form_langcode && $form_langcode != $default_langcode;
}