Skip to content
Snippets Groups Projects
Commit 9184552e authored by Jürgen Haas's avatar Jürgen Haas
Browse files

Issue #3258323 by jurgenhaas, rkoller: After the model name is set the...

Issue #3258323 by jurgenhaas, rkoller: After the model name is set the page-title isn't updated after the initial save of a new model
parent 4bbbbf9c
Branches
Tags
1 merge request!64Issue #3258323: After the model name is set the page-title isn't updated after the initial save of a new model
......@@ -4,9 +4,11 @@ namespace Drupal\eca\Controller;
use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Ajax\MessageCommand;
use Drupal\Core\Ajax\RedirectCommand;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Url;
use Drupal\eca\Service\Modellers;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
......@@ -72,6 +74,11 @@ class EcaController extends ControllerBase {
if ($modeller = $this->modellerServices->getModeller($modeller_id)) {
try {
$modeller->save($this->request->getContent());
$referrer = $this->request->server->get('HTTP_REFERER');
$editUrl = Url::fromRoute('entity.eca.edit_form', ['eca' => strtolower($modeller->getId())], ['absolute' => TRUE])->toString();
if ($referrer !== $editUrl) {
$response->addCommand(new RedirectCommand($editUrl));
}
$message = new MessageCommand('Successfully saved the model.', NULL, [
'type' => 'status',
]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment