first commit

This commit is contained in:
2025-08-02 16:30:27 +02:00
commit 23646bfcee
14851 changed files with 1750626 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
<?php
declare(strict_types=1);
namespace KupShop\ArticlesBundle\GTM\PageViews;
use KupShop\ComponentsBundle\Interfaces\GTMComponentInterface;
use KupShop\ComponentsBundle\Twig\BaseComponent;
use KupShop\GTMBundle\PageType\ArticlePageType;
class Article extends ArticlePageType implements GTMComponentInterface
{
/**
* @param \KupShop\ArticlesBundle\Twig\Components\Articles\Detail\View $component
*/
public function getPushData($component): object
{
$a = new \stdClass();
$article = $component->articleForGTM();
$a->category = $article['section']['name'] ?? '';
$a->name = $article['title'];
$a->tags = array_values($article['tags'] ?? []);
$a->authors = array_values(array_map(function ($author) {
return [
'name' => $author['name'],
'email' => $author['email'],
'id' => $author['id'],
];
}, $article['authors'] ?? []));
$a->date_created = date_create($article['date'])->format('Y-m-d');
$a->read_time = $article['data']['readTime'] ?? false;
return (object) ['article' => $a];
}
protected function getFirstRelatedBranch($aID)
{
return sqlQueryBuilder()
->select('ab.name')
->from('articles_relation', 'ar')
->leftJoin('ar', 'articles_branches', 'ab', 'ar.id_branch = ab.id')
->where('ar.id_art=:aID')
->setParameter('aID', $aID)
->setMaxResults(1)
->execute()
->fetchOne();
}
public function getPageTypeString(BaseComponent $component): ?string
{
return 'article';
}
}

View File

@@ -0,0 +1,26 @@
<?php
namespace KupShop\ArticlesBundle\GTM\PageViews;
use KupShop\ArticlesBundle\Twig\Components\Articles\View;
use KupShop\ComponentsBundle\Interfaces\GTMComponentInterface;
use KupShop\ComponentsBundle\Twig\BaseComponent;
use KupShop\GTMBundle\PageType\ArticlesViewType;
class Articles extends ArticlesViewType implements GTMComponentInterface
{
/** @param View $component */
public function getPushData($component): object
{
return (object) [
'articles' => [
'artPath' => $this->getBreadcrumbsWithoutCurrent(),
],
];
}
public function getPageTypeString(BaseComponent $component): ?string
{
return 'blog';
}
}