2 declare(strict_types = 1);
43 if (!empty($params[
'page'][
'description'])) {
45 $manager->addProperty(
'description', $params[
'page'][
'description']);
48 if (!empty($params[
'page'][
'og_title'])) {
50 $manager->addProperty(
'og:title', $params[
'page'][
'og_title']);
53 if (!empty($params[
'page'][
'og_description'])) {
55 $manager->addProperty(
'og:description', $params[
'page'][
'og_description']);
58 if (!empty($params[
'page'][
'og_image'])) {
59 $fileCollector = GeneralUtility::makeInstance(FileCollector::class);
60 $fileCollector->addFilesFromRelation(
'pages',
'og_image', $params[
'page']);
64 foreach ($ogImages as $ogImage) {
66 $subProperties[
'url'] = $ogImage[
'url'];
67 $subProperties[
'width'] = $ogImage[
'width'];
68 $subProperties[
'height'] = $ogImage[
'height'];
70 if (!empty($ogImage[
'alternative'])) {
71 $subProperties[
'alt'] = $ogImage[
'alternative'];
74 $manager->addProperty(
87 $manager->addProperty(
'twitter:card',
'summary');
89 if (!empty($params[
'page'][
'twitter_title'])) {
91 $manager->addProperty(
'twitter:title', $params[
'page'][
'twitter_title']);
94 if (!empty($params[
'page'][
'twitter_description'])) {
96 $manager->addProperty(
'twitter:description', $params[
'page'][
'twitter_description']);
99 if (!empty($params[
'page'][
'twitter_image'])) {
100 $fileCollector = GeneralUtility::makeInstance(FileCollector::class);
101 $fileCollector->addFilesFromRelation(
'pages',
'twitter_image', $params[
'page']);
105 foreach ($twitterImages as $twitterImage) {
108 if (!empty($twitterImage[
'alternative'])) {
109 $subProperties[
'alt'] = $twitterImage[
'alternative'];
112 $manager->addProperty(
114 $twitterImage[
'url'],
120 $noIndex = ((bool)$params[
'page'][
'no_index']) ?
'noindex' :
'index';
121 $noFollow = ((bool)$params[
'page'][
'no_follow']) ?
'nofollow' :
'follow';
123 if ($noIndex ===
'noindex' || $noFollow ===
'nofollow') {
125 $manager->addProperty(
'robots', implode(
',', [$noIndex, $noFollow]));
135 $imageService = GeneralUtility::makeInstance(ImageService::class);
140 foreach ($fileReferences as $file) {
141 $arguments = $file->getProperties();
143 $cropVariant = $arguments[
'cropVariant'] ?:
'social';
144 $cropArea = $cropVariantCollection->getCropArea($cropVariant);
145 $crop = $cropArea->makeAbsoluteBasedOnFile($file);
147 $cropInformation = $crop->asArray();
149 $processingConfiguration = [
153 $processedImage = $file->getOriginalFile()->process(
155 $processingConfiguration
158 $imageUri = $imageService->getImageUri($processedImage,
true);
162 'width' => floor($cropInformation[
'width']),
163 'height' => floor($cropInformation[
'height']),
164 'alternative' => $arguments[
'alternative'],
168 return $socialImages;