コード例 #1
0
 /**
  * @param TaxonomyTermInterface $term
  * @param string                $parent
  * @return string
  */
 public function slugify(TaxonomyTermInterface $term, $parent = 'subject')
 {
     return $this->filter->filter(substr($this->processSlugs($term, $parent), 0, -1));
 }
コード例 #2
0
 protected function slugify($text)
 {
     $slugify = new Slugify();
     $shortify = new Shortify();
     $slugified = [];
     $text = $shortify->filter($text);
     foreach (explode('/', $text) as $token) {
         $token = $slugify->filter($token);
         if (empty($token)) {
             continue;
         }
         $slugified[] = $token;
     }
     $text = implode('/', $slugified);
     return $text;
 }