private function addTermData($termData)
    {
        $labelsByThesaurusId = [];

        foreach ($termData as $currentTerm) {
            $label = $currentTerm['expansions_terms'];

            if (isset($currentTerm['expanded_term']) && $currentTerm['expanded_term']) {
                $label = sprintf("%s => %s", $currentTerm['expanded_term'], $label);
            }

            $labelsByThesaurusId[$currentTerm['thesaurus_id']][] = $label;
        }

        foreach ($labelsByThesaurusId as $thesaurusId => $labels) {
            $this->_items[$thesaurusId]->setData('terms_summary', implode(" <br/> ", $labels));
        }

        return $this;
    }
private function addTermData($termData)
    {
        $labelsByThesaurusId = [];

        foreach ($termData as $currentTerm) {
            $label = $currentTerm['expansions_terms'];

            if (isset($currentTerm['expanded_term']) && $currentTerm['expanded_term']) {
                $label = sprintf("%s => %s", $currentTerm['expanded_term'], $label);
            }

            $labelsByThesaurusId[$currentTerm['thesaurus_id']][] = $label;
        }

        foreach ($labelsByThesaurusId as $thesaurusId => $labels) {
            $this->_items[$thesaurusId]->setData('terms_summary', implode(" <br/> ", $labels));
        }

        return $this;
    }
private function addTermData ( $ termData ) { $ labelsByThesaurusId = [ ] ; foreach ( $ termData as $ currentTerm ) { $ label = $ currentTerm [ 'expansions_terms' ] ; if ( isset ( $ currentTerm [ 'expanded_term' ] ) && $ currentTerm [ 'expanded_term' ] ) { $ label = sprintf ( "%s => %s" , $ currentTerm [ 'expanded_term' ] , $ label ) ; } $ labelsByThesaurusId [ $ currentTerm [ 'thesaurus_id' ] ] [ ] = $ label ; } foreach ( $ labelsByThesaurusId as $ thesaurusId => $ labels ) { $ this -> _items [ $ thesaurusId ] -> setData ( 'terms_summary' , implode ( " <br/> " , $ labels ) ) ; } return $ this ; }
Process terms of each thesaurus and display a summary for each thesaurus.

@param array $termData Raw terms data loaded from the DB.

@return $this
Process terms of each thesaurus and display a summary for each thesaurus .