public static function makeBreadcrumb($path) { $func = function ($segment) { return str_replace('-', ' ', PatternLab::stripDigits($segment)); }; $segments = array_map($func, explode('/', $path)); return implode(' > ', array_slice($segments, 0, -1)); }
public function jsonSerialize() { $type = PatternLab::stripDigits($this->name); $items = array_values($this->patterns); if (!empty($this->subtypes)) { $items[] = ["patternPath" => "{$this->name}/index.html", "patternName" => "View All", "patternType" => $this->name, "patternSubtype" => "all", "patternPartial" => "viewall-{$type}-all"]; } return ['patternTypeLC' => $this->getLowercaseName(), 'patternTypeUC' => $this->getUppercaseName(), 'patternType' => $this->getName(), 'patternTypeDash' => $this->getNameWithDashes(), 'patternTypeItems' => array_values($this->subtypes), 'patternItems' => $items]; }
/** * @param $name * @return SubtypeInterface * @throws \OutOfBoundsException */ public function findSubType($name) { return $this->getSubTypes()[PatternLab::stripDigits($name)]; }
public function getNameWithDashes() { return PatternLab::stripDigits($this->getName()); }