Smile\ElasticsuiteThesaurus\Model\ResourceModel\Thesaurus\Collection::addTermData PHP Method

addTermData() private method

Process terms of each thesaurus and display a summary for each thesaurus.
private addTermData ( array $termData )
$termData array Raw terms data loaded from the DB.
    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;
    }