You are here

public function EntityBrowser::route in Entity Browser 8

Same name and namespace in other branches
  1. 8.2 src/Entity/EntityBrowser.php \Drupal\entity_browser\Entity\EntityBrowser::route()

Gets route that matches this display.

Return value

\Symfony\Component\Routing\Route|bool Route object or FALSE if no route is used.

Overrides EntityBrowserInterface::route

File

src/Entity/EntityBrowser.php, line 385

Class

EntityBrowser
Defines an entity browser configuration entity.

Namespace

Drupal\entity_browser\Entity

Code

public function route() {

  // TODO: Allow displays to define more than just path.
  // See: https://www.drupal.org/node/2364193
  $display = $this
    ->getDisplay();
  if ($display instanceof DisplayRouterInterface) {
    $path = $display
      ->path();
    return new Route($path, [
      '_controller' => 'Drupal\\entity_browser\\Controllers\\EntityBrowserFormController::getContentResult',
      '_title_callback' => 'Drupal\\entity_browser\\Controllers\\EntityBrowserFormController::title',
      'entity_browser_id' => $this
        ->id(),
    ], [
      '_permission' => 'access ' . $this
        ->id() . ' entity browser pages',
    ], [
      '_admin_route' => \Drupal::config('node.settings')
        ->get('use_admin_theme'),
    ]);
  }
  return FALSE;
}