Build a route for a given admin and action.

@param \Wanjee\Shuwee\AdminBundle\Admin\AdminInterface $admin
@param string $action
@param array $params
@param bool $defaultRoute

@return \Symfony\Component\Routing\Route
545027
public function getRoute(AdminInterface $admin, $action, $params = [], $isIndex = false)
    {
        $defaults = [];
        $path = '/' . $admin->getAlias();

        // append action if required
        if(!$isIndex) {
            $path .= '/' . $action;
        }

        foreach($params as $paramKey => $paramValue) {
            if(is_int($paramKey)) {
                $paramName = $paramValue;
            }
            else {
                $paramName = $paramKey;
                $defaults[$paramName] = $paramValue;
            }
            $path .= '/{' . $paramName . '}';
        }

        $controller = 'ShuweeAdminBundle:Content:' . $action;

        $defaults = array_merge(
          [
            '_controller' => $controller,
            'alias' => $admin->getAlias(),

          ],
          $defaults
        );

        return new Route($path, $defaults);
    }
1184143
protected function newRoute($methods, $uri, $action)
    {
        $route = (new Route($methods, $uri, $action))->setContainer($this->container);
        $priority = self::DEFAULT_PRIORITY - $this->routes->count();
        $route->setPriority($priority);

        return $route;
    }
239043
public function amOnAction($action, $params = [])
    {
        $route = $this->getRouteByAction($action);
        $absolute = !is_null($route->domain());
        $url = $this->app['url']->action($action, $params, $absolute);

        $this->amOnPage($url);
    }
749938
protected function mapAdminRoutes()
    {
        $this->prefix($this->config()->get('arcanesoft.media.route.prefix', 'media'))
             ->name('media.')
             ->group(function () {
                 Routes\Admin\MediaRoutes::register();
                 Routes\Admin\ApiRoutes::register();
             });
    }
109180
private function _createRoute( $options )
    {
        $url = $this->_di->getService( "url" );

        /**
         * All route uris should have the uri prefix
         */
        $options["uri"] = $url->getUriPrefix() . $options["uri"];

        if (isset($options["controller_action"]))
        {
            $controller_action_exploded = explode( "#", $options["controller_action"] );

            $options["controllerName"] = $controller_action_exploded[0];
            $options["actionName"]     = $controller_action_exploded[1];
        }

        // $uri            = $settings["uri"];
        //
        // $controllerName = $settings["controllerName"];
        //
        // $actionName     = $settings["actionName"];
        //
        // $params         = $settigns["params"];

        return new Route($options);
    }
909887
private function buildOobLink($param, $action) {
    $code = $this->rpcHelper->getOobCode($param);
    $separator = parse_url($this->widgetUrl, PHP_URL_QUERY) ? '&' : '?';
    return $this->widgetUrl . $separator  .
        http_build_query(array('mode' => $action, 'oobCode' => $code));
  }
1076163
public function addInternal($rule, $action = null)
    {
        $route = $this->di->get('route');
        $route->set($rule, $action);
        $this->internalRoutes[$rule] = $route;
        return $route;
    }
206242
public function action($action, $parameters = array(), $absolute = true)
    {
        return $this->route($action, $parameters, $absolute, $this->routes->getByAction($action));
    }
1322358
public static function addToVueRoute($adminVueRoutesPath, $adminJs = 'assets/js/entries/admin.js')
    {
        $adminEntryPath = resource_path($adminJs);
        $adminEntryFile = file_get_contents($adminEntryPath);
        if (!str_contains($adminEntryFile, $adminVueRoutesPath)) {
            Utils::replaceFilePlaceholders($adminEntryPath, [
                '// Modules routes' => '  ' . $adminVueRoutesPath . ",\n" . '// Modules routes'
            ], null, '');
        }
    }
347093
public function getSideMenu($action, AdminInterface $childAdmin = null)
    {
        if ($this->isChild()) {
            return $this->getParent()->getSideMenu($action, $this);
        }

        $this->buildSideMenu($action, $childAdmin);

        return $this->menu;
    }
758923
public function configureBatchActions(AdminInterface $admin, array $actions)
    {
        /** @var AbstractAdmin $admin */
        if ($admin->hasRoute('edit') && $admin->hasAccess('edit') && $admin->getList()->has('enabled')) {
            $actions['enable'] = [
            ];

            $actions['disable'] = [
            ];
        }

        return $actions;
    }
987348
protected function redirectAction ($action, $params=array())
    {
        // Get controller public name
        $ctrlPubName = \Teon\Base\Stdlib\ClassUtils::getPublicControllerName(get_class($this));

        // Get original parameters
        $paramsOrig = $this->params()->fromRoute();

        // Combine parameters - if action is explicitly specified in params it is overriden
        $params2pass = array_merge(
            $paramsOrig,
            $params,
            array('action' => $action)
        );

        // Do the redirect
        return $this->redirect()->toRoute($ctrlPubName, $params2pass);
    }
270129
public function add($rule, $action = null)
    {
        $route = $this->di->get('route');
        $route->set($rule, $action);
        $this->routes[] = $route;

        // Set as default route
        if ($rule == "*") {
            $this->defaultRoute = $route;
        }
        
        return $route;
    }
1113425
public function action($action, $parameters = [], array $query = [])
    {
        $callback = function (Route $route) use ($action) {

            return $route->getActionName() === $action && $route->acceptedVerb('GET');
        };

        $route = $this->getRouteCollection()->firstOrFail($callback);

        return $this->to($route->toUri((array) $parameters), $query);
    }
60368
final public function forward(string $controller, $action = null) :void {

		// get the current route as a base
		$route = Router::getCurrentRoute();
		
		// and alter it
		$route->controller	= $controller;
		$route->action		= $action;
		
		// forward to the new route
		Router::forward($route);
		
	}
869478
public function renderDefaultView(\Twig_Environment $env, $route, array $params = [])
	{
		return $this->renderView($env, $this->pm->getLastManagerName(), $route, $params);
	}
48407
public function adminHelpAction(Request $request, $adminCode, $action = '')
    {
        $parameters = ['adminCode' => $adminCode, 'action' => $action];
        $defaultAdminCode = ['dashboard', 'overview'];

        if ($action == '') {
            $translationKey = $adminCode;
        } else {
            $translationKey = $adminCode.'.'.$action;
        }

        $helpTextManager = $this->get('networking_init_cms.help_text_manager');
        $helpText = $helpTextManager->getHelpTextByKeyLocale($translationKey, $request->getLocale());

        $parameters['help_text'] = $helpText;
        if (!in_array($adminCode, $defaultAdminCode)) {
            $admin = $this->container->get('sonata.admin.pool')->getAdminByAdminCode($adminCode);
            $admin->setRequest($request);
            $parameters['admin'] = $admin;
        }

        /** @var \Networking\InitCmsBundle\Admin\Pool $pool */
        $pool = $this->get('sonata.admin.pool');
        $parameters['admin_pool'] = $pool;
        $parameters['base_template'] = isset($admin) ? $this->getBaseTemplate($request, $admin) : '@NetworkingInitCms/admin_layout.html.twig';
        $dashBoardGroups = $pool->getDashboardNavigationGroups();

        $parameters['help_nav'] = $this->adminGetHelpTextNavigation(
            $dashBoardGroups,
            $request->getLocale(),
            $helpTextManager
        );

        return $this->render(
            '@NetworkingInitCms/HelpText/adminHelp.html.twig',
            $parameters
        );
    }