Frontend\Modules\Tags\Widgets\Related::getTags PHP Method

getTags() private method

Get tags for current "page"
private getTags ( )
    private function getTags()
    {
        // get page id
        $pageId = $this->getContainer()->get('page')->getId();
        // array of excluded records
        $this->exclude[] = array('module' => 'Pages', 'other_id' => $pageId);
        // get tags for page
        $tags = (array) FrontendTagsModel::getForItem('pages', $pageId);
        foreach ($tags as $tag) {
            $this->tags = array_merge((array) $this->tags, (array) $tag['name']);
        }
        // get page record
        $record = (array) FrontendNavigation::getPageInfo($pageId);
        // loop blocks
        foreach ((array) $record['extra_blocks'] as $block) {
            // set module class
            $class = 'Frontend\\Modules\\' . $block['module'] . '\\Engine\\Model';
            if (is_callable(array($class, 'getIdForTags'))) {
                // get record for module
                $record = FrontendTagsModel::callFromInterface($block['module'], $class, 'getIdForTags', $this->URL);
                // check if record exists
                if (!$record) {
                    continue;
                }
                // add to excluded records
                $this->exclude[] = array('module' => $block['module'], 'other_id' => $record['id']);
                // get record's tags
                $tags = (array) FrontendTagsModel::getForItem($block['module'], $record['id']);
                foreach ($tags as $tag) {
                    $this->tags = array_merge((array) $this->tags, (array) $tag['name']);
                }
            }
        }
    }