Commit f57fa8d9 authored by Tess's avatar Tess Committed by Tess
Browse files

Issue #2873567 by socketwench: Turning on a flag for a paragraph results in Uncaught PHP Exception

parent 7d097f4d
Loading
Loading
Loading
Loading
+9 −1
Changes for src/Controller/ActionLinkController.php: 9 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -9,9 +9,11 @@ use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\EventSubscriber\MainContentViewSubscriber;
use Drupal\Core\Render\RendererInterface;
use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\flag\FlagInterface;
use Drupal\flag\FlagServiceInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;

/**
@@ -150,12 +152,18 @@ class ActionLinkController extends ControllerBase implements ContainerInjectionI

      return $response;
    }
    else {
    elseif ($entity->hasLinkTemplate('canonical')) {
      // Redirect back to the entity. A passed in destination query parameter
      // will automatically override this.
      $url_info = $entity->toUrl();
      return $this->redirect($url_info->getRouteName(), $url_info->getRouteParameters());
    }
    else {
      // For entities that don't have a canonical URL (like paragraphs),
      // redirect to the front page.
      $front = Url::fromUri('internal:/');
      return new RedirectResponse($front);
    }

  }