You are here

public function StockLocationTranslationHandler::entityFormEntityBuild in Commerce Stock 8

Entity builder method.

Parameters

string $entity_type: The type of the entity.

\Drupal\Core\Entity\EntityInterface $entity: The entity whose form is being built.

Overrides ContentTranslationHandler::entityFormEntityBuild

See also

\Drupal\content_translation\ContentTranslationHandler::entityFormAlter()

File

modules/local_storage/src/StockLocationTranslationHandler.php, line 52

Class

StockLocationTranslationHandler
Defines the translation handler for commerce stock locations.

Namespace

Drupal\commerce_stock_local

Code

public function entityFormEntityBuild($entity_type, EntityInterface $entity, array $form, FormStateInterface $form_state) {

  /** @var \Drupal\commerce_stock_local\Entity\StockLocation $entity */
  if ($form_state
    ->hasValue('content_translation')) {
    $translation =& $form_state
      ->getValue('content_translation');
    $translation['status'] = $entity
      ->isActive();
  }
  parent::entityFormEntityBuild($entity_type, $entity, $form, $form_state);
}