This topic contains 1 reply, has 2 voices, and was last updated by Yurii Muratov 6 years, 6 months ago.
- Topic
I have created a custom module called promotions. In update.html.twig I have created a button such as Save, Save & New, Save & Close . On click of those buttons the entity get saved however Save & Close , Save & New do not redirect to the respective routes.
Below is the code. Please suggest if I have missed something
In update.html.twig
1234567891011121314151617181920212223242526272829303132333435363738394041{% block navButtons %}{% if form.vars.value.id and is_granted("DELETE",form.vars.value) %}{{UI.deleteButton({"dataUrl" : path("hkoPromotion.promotion_api_delete",{ id: form.vars.value.id}),"dataRedirect": "hkoPromotion.promotion_index","aCss": "no-hash remove-button","id": "btn-remove-tag","dataId" : form.vars.value.id,"entity_label": "hko.promotion.entity_label"|trans})}}{% endif %}{{ UI.cancelButton(path("hkoPromotion.promotion_index")) }}{% set html = UI.saveAndCloseButton({'route': 'hkoPromotion.promotion_view','params': {'id': '$id'}}) %}{% if is_granted("hkoPromotion.promotion_create") %}{% set html = html ~ UI.saveAndNewButton({'route': 'hkoPromotion.promotion_create'}) %}{% endif %}{% if is_granted("hkoPromotion.promotion_update") %}{% set html = html ~ UI.saveAndStayButton({'route': 'hkoPromotion.promotion_update','params': {'id': '$id'}}) %}{% endif %}{{ UI.dropdownSaveButton({"html" : html}) }}{% endblock navButtons %}In Promotion Controller
123456789101112131415public function update(Promotion $promotion , Request $request) {$form = $this->createForm(PromotionType::NAME , $promotion);$handler = $this->get('oro_form.model.update_handler'); //oro_form.update_handler$saveMessage = $this->get('translator')->trans('hko.promotion.messages.saved');$handler->update( $promotion, $form, $saveMessage );return array ("entity" => $promotion,"form"=>$form->createView());}
The forum ‘OroCRM – How do I? Questions’ is closed to new topics and replies.