Loading modules/promotion/src/Form/PromotionDisableForm.php +1 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ class PromotionDisableForm extends ContentEntityConfirmFormBase { $promotion = $this->getEntity(); $promotion->setEnabled(FALSE); $promotion->save(); $this->messenger()->addStatus($this->t('Successfully disabled the promotion %label', ['%label' => $promotion->label()])); $this->messenger()->addStatus($this->t('Successfully disabled the promotion %label.', ['%label' => $promotion->label()])); $form_state->setRedirectUrl($this->getCancelUrl()); } Loading modules/promotion/src/Form/PromotionEnableForm.php +1 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ class PromotionEnableForm extends ContentEntityConfirmFormBase { $promotion = $this->getEntity(); $promotion->setEnabled(TRUE); $promotion->save(); $this->messenger()->addStatus($this->t('Successfully enabled the promotion %label', ['%label' => $promotion->label()])); $this->messenger()->addStatus($this->t('Successfully enabled the promotion %label.', ['%label' => $promotion->label()])); $form_state->setRedirectUrl($this->getCancelUrl()); } Loading modules/promotion/src/PromotionListBuilder.php +15 −0 Original line number Diff line number Diff line Loading @@ -269,6 +269,21 @@ class PromotionListBuilder extends EntityListBuilder implements FormInterface { 'commerce_promotion' => $entity->id(), ]), ]; if (!$entity->isEnabled() && $entity->hasLinkTemplate('enable-form')) { $operations['enable'] = [ 'title' => $this->t('Enable'), 'weight' => -10, 'url' => $this->ensureDestination($entity->toUrl('enable-form')), ]; } elseif ($entity->hasLinkTemplate('disable-form')) { $operations['disable'] = [ 'title' => $this->t('Disable'), 'weight' => 40, 'url' => $this->ensureDestination($entity->toUrl('disable-form')), ]; } } return $operations; Loading Loading
modules/promotion/src/Form/PromotionDisableForm.php +1 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ class PromotionDisableForm extends ContentEntityConfirmFormBase { $promotion = $this->getEntity(); $promotion->setEnabled(FALSE); $promotion->save(); $this->messenger()->addStatus($this->t('Successfully disabled the promotion %label', ['%label' => $promotion->label()])); $this->messenger()->addStatus($this->t('Successfully disabled the promotion %label.', ['%label' => $promotion->label()])); $form_state->setRedirectUrl($this->getCancelUrl()); } Loading
modules/promotion/src/Form/PromotionEnableForm.php +1 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ class PromotionEnableForm extends ContentEntityConfirmFormBase { $promotion = $this->getEntity(); $promotion->setEnabled(TRUE); $promotion->save(); $this->messenger()->addStatus($this->t('Successfully enabled the promotion %label', ['%label' => $promotion->label()])); $this->messenger()->addStatus($this->t('Successfully enabled the promotion %label.', ['%label' => $promotion->label()])); $form_state->setRedirectUrl($this->getCancelUrl()); } Loading
modules/promotion/src/PromotionListBuilder.php +15 −0 Original line number Diff line number Diff line Loading @@ -269,6 +269,21 @@ class PromotionListBuilder extends EntityListBuilder implements FormInterface { 'commerce_promotion' => $entity->id(), ]), ]; if (!$entity->isEnabled() && $entity->hasLinkTemplate('enable-form')) { $operations['enable'] = [ 'title' => $this->t('Enable'), 'weight' => -10, 'url' => $this->ensureDestination($entity->toUrl('enable-form')), ]; } elseif ($entity->hasLinkTemplate('disable-form')) { $operations['disable'] = [ 'title' => $this->t('Disable'), 'weight' => 40, 'url' => $this->ensureDestination($entity->toUrl('disable-form')), ]; } } return $operations; Loading