Пример #1
0
 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));
 }
Пример #2
0
 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];
 }
Пример #3
0
 /**
  * @param $name
  * @return SubtypeInterface
  * @throws \OutOfBoundsException
  */
 public function findSubType($name)
 {
     return $this->getSubTypes()[PatternLab::stripDigits($name)];
 }
Пример #4
0
 public function getNameWithDashes()
 {
     return PatternLab::stripDigits($this->getName());
 }