/** * @param string $layout * @return string */ public function findLayoutType($layout) { if (isset($this->layoutTypes[$layout])) { return $this->layoutTypes[$layout]; } $_replaceSearch = array('blog-loop'); $_replaceWith = array('blog-post'); $type = ''; $typesPriorityMap = Set::prioritize($this->layoutTypePriorityMap, $layout); array_pop($typesPriorityMap); // Get rid of the default key foreach ($typesPriorityMap as $type) { $type = $this->Option->find($this->constructOptionId('layoutType', $type)); if ($type) { break; } } if (strpos($type, $layout) === false && $type) { $type = str_replace($_replaceSearch, $_replaceWith, $type); } if ($type) { $this->layoutTypes[$layout] = $type; } return $type; }