ShowButtonsCommand example

$form_state->set('url', $form_url);
      $response = $this->ajaxFormWrapper($form_class$form_state);
    }
    elseif (!$form_state->get('ajax')) {
      // if nothing on the stack, non-js forms just go back to the main view editor.       $display_id = $form_state->get('display_id');
      return new RedirectResponse(Url::fromRoute('entity.view.edit_display_form', ['view' => $view->id(), 'display_id' => $display_id]['absolute' => TRUE])->toString());
    }
    else {
      $response = new AjaxResponse();
      $response->addCommand(new CloseModalDialogCommand());
      $response->addCommand(new ShowButtonsCommand(!empty($view->changed)));
      $response->addCommand(new TriggerPreviewCommand());
      if ($page_title = $form_state->get('page_title')) {
        $response->addCommand(new ReplaceTitleCommand($page_title));
      }
    }
    // If this form was for view-wide changes, there's no need to regenerate     // the display section of the form.     if ($display_id !== '') {
      \Drupal::entityTypeManager()->getFormObject('view', 'edit')->rebuildCurrentTab($view$response$display_id);
    }

    
Home | Imprint | This part of the site doesn't use cookies.