/** * Recursively search route config to find those route names that reference a prismic mask/type * @param array $routes * @param string $parent * @return array */ protected function findRoutesReferencedToMasks(array $routes, $parent = '') { $searchParam = $this->routerOptions->getMaskParam(); $out = array(); foreach ($routes as $name => $route) { $fqrn = trim($parent . '/' . $name, '/'); $maskName = isset($route['options']['defaults'][$searchParam]) ? $route['options']['defaults'][$searchParam] : NULL; if (!empty($maskName)) { $out[$maskName] = $fqrn; } if (isset($route['child_routes']) && count($route['child_routes'])) { $out = array_merge($out, $this->findRoutesReferencedToMasks($route['child_routes'], $name)); } } return $out; }
/** * Return the document UID from the current matched route * @return string|NULL */ public function getDocumentUidFromRoute() { $params = $this->getController()->plugin('params'); $search = $this->routerOptions->getUidParam(); return $params->fromRoute($search); }