public function PromotionTranslationHandler::entityFormEntityBuild in Commerce Core 8.2
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/
promotion/ src/ PromotionTranslationHandler.php, line 30
Class
- PromotionTranslationHandler
- Defines the translation handler for promotions.
Namespace
Drupal\commerce_promotionCode
public function entityFormEntityBuild($entity_type, EntityInterface $entity, array $form, FormStateInterface $form_state) {
if ($form_state
->hasValue('content_translation')) {
$translation =& $form_state
->getValue('content_translation');
/** @var \Drupal\commerce_promotion\Entity\PromotionInterface $entity */
$translation['status'] = $entity
->isEnabled();
$translation['uid'] = 0;
}
parent::entityFormEntityBuild($entity_type, $entity, $form, $form_state);
}