Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Release 10.1.0 #585

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ This changelog is according to [Keep a Changelog](http://keepachangelog.com).
All notable changes to this project will be documented in this file.
We will follow [Semantic Versioning](http://semver.org/).

## UNRELEASED
### Added
- `TypoScriptStructuredDataProvider` to add structured data to the page, configured with TypoScript (premium functionality)

### Fixed
- Renamed `JavascriptModules.php` to `JavaScriptModules.php`

### Changed
- Removed the premium support mention within the documentation

## 10.0.0 October 15, 2024
### Breaking
- Dropped support for TYPO3 10
Expand Down
54 changes: 54 additions & 0 deletions Classes/StructuredData/TypoScriptStructuredDataProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php

declare(strict_types=1);

namespace YoastSeoForTypo3\YoastSeo\StructuredData;

use TYPO3\CMS\Core\Domain\Repository\PageRepository;
use TYPO3\CMS\Core\Site\SiteFinder;
use TYPO3\CMS\Core\TypoScript\TypoScriptService;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;

class TypoScriptStructuredDataProvider implements StructuredDataProviderInterface
{
public function __construct(
protected SiteFinder $siteFinder,
protected PageRepository $pageRepository,
protected TypoScriptService $typoScriptService,
) {}

/**
* @return array<array<string, mixed>>
*/
public function getData(): array
{
$data = [];

foreach (
$this->getTyposcriptFrontendController()->config['config']['structuredData.']['data.'] ?? [] as $dataConfig
) {
if (array_key_exists('type', $dataConfig) && array_key_exists('context', $dataConfig)) {
$item = [];
$config = $this->typoScriptService->convertTypoScriptArrayToPlainArray($dataConfig);

foreach ($config as $key => $value) {
$cObject = $key . '.';
if (isset($dataConfig[$cObject])) {
$value = $this->getTyposcriptFrontendController()->cObj->stdWrap($key, $dataConfig[$cObject]);

Check failure on line 37 in Classes/StructuredData/TypoScriptStructuredDataProvider.php

View workflow job for this annotation

GitHub Actions / Build PHP (12, php8.2, false)

Parameter #1 $content of method TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::stdWrap() expects string, int|string given.

Check failure on line 37 in Classes/StructuredData/TypoScriptStructuredDataProvider.php

View workflow job for this annotation

GitHub Actions / Build PHP (13, php8.2, false)

Parameter #1 $content of method TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::stdWrap() expects string, int|string given.

Check failure on line 37 in Classes/StructuredData/TypoScriptStructuredDataProvider.php

View workflow job for this annotation

GitHub Actions / Build PHP (12, php8.2, false)

Parameter #1 $content of method TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::stdWrap() expects string, int|string given.

Check failure on line 37 in Classes/StructuredData/TypoScriptStructuredDataProvider.php

View workflow job for this annotation

GitHub Actions / Build PHP (13, php8.2, false)

Parameter #1 $content of method TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::stdWrap() expects string, int|string given.
}
$key = in_array($key, ['type', 'context']) ? '@' . $key : $key;

$item[$key] = $value;
}
$data[] = $item;
}
}

return (array)$data;
}

protected function getTyposcriptFrontendController(): TypoScriptFrontendController
{
return $GLOBALS['TSFE'];
}
}
5 changes: 5 additions & 0 deletions Configuration/TypoScript/Setup/Config.typoscript
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ config {
site {
provider = YoastSeoForTypo3\YoastSeo\StructuredData\SiteStructuredDataProvider
}

typoscript {
provider = YoastSeoForTypo3\YoastSeo\StructuredData\TypoScriptStructuredDataProvider
after = breadcrumb
}
}
pageTitleProviders {
yoastRecord {
Expand Down
5 changes: 1 addition & 4 deletions Documentation/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,7 @@ and help editors write high quality content.
.. tip::

Community support is available in the TYPO3 Slack channel
`#yoast-seo-for-typo3 <https://typo3.slack.com/archives/C14EQDFL1>`__. If you
want support for your installation, you can buy our
`premium plugin <https://yoast.com/typo3-extensions-seo/>`__ and get 24/7
support.
`#yoast-seo-for-typo3 <https://typo3.slack.com/archives/C14EQDFL1>`__.

.. note::

Expand Down
Loading