protected function setTermsPermalink(array $items, $taxonomyAttribute, array $terms, $termRelativePath)
    {
        foreach ($items as $item) {
            $attributes = $item->getAttributes();

            if (isset($attributes['term_urls'])) {
                $attributes['term_urls'] = [];
            }

            if (isset($attributes['term_urls'][$taxonomyAttribute])) {
                $attributes['term_urls'][$taxonomyAttribute] = [];
            }

            $slugedTermPermalink = $this->getTermPermalink($termRelativePath);

            foreach ($terms as $term) {
                $attributes['terms_url'][$taxonomyAttribute][$term] = $slugedTermPermalink;
            }

            $item->setAttributes($attributes);
        }
    }
protected function setTermsPermalink(array $items, $taxonomyAttribute, array $terms, $termRelativePath)
    {
        foreach ($items as $item) {
            $attributes = $item->getAttributes();

            if (isset($attributes['term_urls'])) {
                $attributes['term_urls'] = [];
            }

            if (isset($attributes['term_urls'][$taxonomyAttribute])) {
                $attributes['term_urls'][$taxonomyAttribute] = [];
            }

            $slugedTermPermalink = $this->getTermPermalink($termRelativePath);

            foreach ($terms as $term) {
                $attributes['terms_url'][$taxonomyAttribute][$term] = $slugedTermPermalink;
            }

            $item->setAttributes($attributes);
        }
    }
protected function setTermsPermalink ( array $ items , $ taxonomyAttribute , array $ terms , $ termRelativePath ) { foreach ( $ items as $ item ) { $ attributes = $ item -> getAttributes ( ) ; if ( isset ( $ attributes [ 'term_urls' ] ) ) { $ attributes [ 'term_urls' ] = [ ] ; } if ( isset ( $ attributes [ 'term_urls' ] [ $ taxonomyAttribute ] ) ) { $ attributes [ 'term_urls' ] [ $ taxonomyAttribute ] = [ ] ; } $ slugedTermPermalink = $ this -> getTermPermalink ( $ termRelativePath ) ; foreach ( $ terms as $ term ) { $ attributes [ 'terms_url' ] [ $ taxonomyAttribute ] [ $ term ] = $ slugedTermPermalink ; } $ item -> setAttributes ( $ attributes ) ; } }
Sets the permalink's term to a list of items associated with that term.

@param array  $items             List of items associated with a the term
@param string $taxonomyAttribute The item's attribute used for grouping by
@param array  $terms             Term or set of sluged equivalent terms
@param string $termRelativePath  Relative path to the term.
Used for generating the permalink
Sets the permalink s term to a list of items associated with that term .