Frontend\Modules\Blog\Engine\Model::getForTags PHP Method

getForTags() public static method

Fetch the list of tags for a list of items
public static getForTags ( array $ids ) : array
$ids array The ids of the items to grab.
return array
    public static function getForTags(array $ids)
    {
        // fetch items
        $items = (array) FrontendModel::getContainer()->get('database')->getRecords('SELECT i.title, m.url
             FROM blog_posts AS i
             INNER JOIN meta AS m ON m.id = i.meta_id
             WHERE i.status = ? AND i.hidden = ? AND i.id IN (' . implode(',', $ids) . ') AND i.publish_on <= ?
             ORDER BY i.publish_on DESC', array('active', 'N', FrontendModel::getUTCDate('Y-m-d H:i')));
        // has items
        if (!empty($items)) {
            // init var
            $link = FrontendNavigation::getURLForBlock('Blog', 'Detail');
            $folders = FrontendModel::getThumbnailFolders(FRONTEND_FILES_PATH . '/Blog/Images', true);
            // reset url
            foreach ($items as &$row) {
                $row['full_url'] = $link . '/' . $row['url'];
                // image?
                if (isset($row['image'])) {
                    foreach ($folders as $folder) {
                        $row['image_' . $folder['dirname']] = $folder['url'] . '/' . $folder['dirname'] . '/' . $row['image'];
                    }
                }
            }
        }
        // return
        return $items;
    }