38 lines
1.1 KiB
PHP
38 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace KupShop\ContentBundle\Sitemap;
|
|
|
|
use KupShop\ContentBundle\Util\MenuUtil;
|
|
use KupShop\I18nBundle\Translations\MenuLinksTranslation;
|
|
use Query\Translation;
|
|
|
|
class MenuSitemap extends BaseSitemap
|
|
{
|
|
protected static $type = \Modules::MENU;
|
|
protected static $module = \Modules::MENU;
|
|
|
|
public function getData(): \Generator
|
|
{
|
|
$cfg = \KupShop\KupShopBundle\Config::get();
|
|
|
|
$menuList = sqlQueryBuilder()
|
|
->select('ml.url')
|
|
->from('menu_links', 'ml')
|
|
->where(\Query\Operator::equals(['show_in_search' => 'Y']))
|
|
->andWhere('ml.type='.MenuUtil::TYPE_PAGE)
|
|
->andWhere(Translation::coalesceTranslatedFields(MenuLinksTranslation::class, ['figure', 'name', 'link', 'url']))
|
|
->having('figure="Y"')
|
|
->orderBy('list_order', 'ASC')
|
|
->execute();
|
|
|
|
foreach ($menuList as $menu) {
|
|
$url = $cfg['Addr']['full'].ltrim($menu['url'], '/');
|
|
yield [
|
|
'loc' => $url,
|
|
'priority' => '0.7',
|
|
'changefreq' => 'monthly',
|
|
];
|
|
}
|
|
}
|
|
}
|