Skip to content

Commit

Permalink
[TASK] Add Yandex as manual provider
Browse files Browse the repository at this point in the history
Related: #49
  • Loading branch information
brotkrueml committed Jun 27, 2020
1 parent dfb9922 commit f6435d4
Show file tree
Hide file tree
Showing 7 changed files with 202 additions and 65 deletions.
23 changes: 20 additions & 3 deletions Classes/ViewHelpers/AdminPanel/PropertyValueViewHelper.php
Expand Up @@ -25,6 +25,17 @@ final class PropertyValueViewHelper extends ViewHelper\AbstractViewHelper
{
private const IMAGE_EXTENSIONS = ['gif', 'jpg', 'jpeg', 'png', 'svg'];

private const MANUAL_PROVIDERS = [
'google' => [
'title' => Extension::LANGUAGE_PATH_DEFAULT . ':adminPanel.openGoogleReference',
'iconIdentifier' => 'ext-schema-documentation-google',
],
'yandex' => [
'title' => Extension::LANGUAGE_PATH_DEFAULT . ':adminPanel.openYandexReference',
'iconIdentifier' => 'ext-schema-documentation-yandex',
],
];

protected $escapeOutput = false;

/** @var RenderingContextInterface */
Expand Down Expand Up @@ -112,11 +123,17 @@ private static function buildLinksForType(string $type): array
];

$additionalManuals = self::getAdditionalManuals();
foreach ($additionalManuals[$type] ?? [] as $manual) {
$manualType = $additionalManuals[$type]['like'] ?? $type;
foreach ($additionalManuals[$manualType] ?? [] as $manual) {
$provider = $manual['provider'] ?? '';
if (!$provider || !\array_key_exists($provider, self::MANUAL_PROVIDERS)) {
continue;
}

$links[] = [
'link' => $manual['link'],
'title' => \sprintf(self::getLanguageService()->sL($manual['title']), $type),
'iconIdentifier' => $manual['iconIdentifier'],
'title' => \sprintf(self::getLanguageService()->sL(self::MANUAL_PROVIDERS[$provider]['title']), $manualType),
'iconIdentifier' => self::MANUAL_PROVIDERS[$provider]['iconIdentifier'],
];
}

Expand Down
121 changes: 66 additions & 55 deletions Configuration/TxSchema/AdditionalManuals.php
Expand Up @@ -13,170 +13,181 @@
return [
'Article' => [
[
'provider' => 'google',
'link' => 'https://developers.google.com/search/docs/data-types/article',
'title' => Brotkrueml\Schema\Extension::LANGUAGE_PATH_DEFAULT . ':adminPanel.openGoogleReference',
'iconIdentifier' => 'ext-schema-documentation-google',
],
],
'Book' => [
[
'provider' => 'google',
'link' => 'https://developers.google.com/search/docs/data-types/book',
'title' => Brotkrueml\Schema\Extension::LANGUAGE_PATH_DEFAULT . ':adminPanel.openGoogleReference',
'iconIdentifier' => 'ext-schema-documentation-google',
],
],
'BreadcrumbList' => [
[
'provider' => 'google',
'link' => 'https://developers.google.com/search/docs/data-types/breadcrumb',
'title' => Brotkrueml\Schema\Extension::LANGUAGE_PATH_DEFAULT . ':adminPanel.openGoogleReference',
'iconIdentifier' => 'ext-schema-documentation-google',
],
],
'ClaimReview' => [
[
'provider' => 'google',
'link' => 'https://developers.google.com/search/docs/data-types/factcheck',
'title' => Brotkrueml\Schema\Extension::LANGUAGE_PATH_DEFAULT . ':adminPanel.openGoogleReference',
'iconIdentifier' => 'ext-schema-documentation-google',
],
],
'Course' => [
[
'provider' => 'google',
'link' => 'https://developers.google.com/search/docs/data-types/course',
'title' => Brotkrueml\Schema\Extension::LANGUAGE_PATH_DEFAULT . ':adminPanel.openGoogleReference',
'iconIdentifier' => 'ext-schema-documentation-google',
],
],
'CreativeWork' => [
[
'provider' => 'yandex',
'link' => 'https://yandex.com/support/webmaster/supported-schemas/essay.html',
],
],
'Dataset' => [
[
'provider' => 'google',
'link' => 'https://developers.google.com/search/docs/data-types/dataset',
'title' => Brotkrueml\Schema\Extension::LANGUAGE_PATH_DEFAULT . ':adminPanel.openGoogleReference',
'iconIdentifier' => 'ext-schema-documentation-google',
],
],
'EducationalOccupationalProgram' => [
[
'provider' => 'google',
'link' => 'https://developers.google.com/search/docs/data-types/job-training',
'title' => Brotkrueml\Schema\Extension::LANGUAGE_PATH_DEFAULT . ':adminPanel.openGoogleReference',
'iconIdentifier' => 'ext-schema-documentation-google',
],
],
'EmployerAggregateRating' => [
[
'provider' => 'google',
'link' => 'https://developers.google.com/search/docs/data-types/employer-rating',
'title' => Brotkrueml\Schema\Extension::LANGUAGE_PATH_DEFAULT . ':adminPanel.openGoogleReference',
'iconIdentifier' => 'ext-schema-documentation-google',
],
],
'Event' => [
[
'provider' => 'google',
'link' => 'https://developers.google.com/search/docs/data-types/event',
'title' => Brotkrueml\Schema\Extension::LANGUAGE_PATH_DEFAULT . ':adminPanel.openGoogleReference',
'iconIdentifier' => 'ext-schema-documentation-google',
],
],
'FAQPage' => [
[
'provider' => 'google',
'link' => 'https://developers.google.com/search/docs/data-types/faqpage',
'title' => Brotkrueml\Schema\Extension::LANGUAGE_PATH_DEFAULT . ':adminPanel.openGoogleReference',
'iconIdentifier' => 'ext-schema-documentation-google',
],
],
'HowTo' => [
[
'provider' => 'google',
'link' => 'https://developers.google.com/search/docs/data-types/how-to',
'title' => Brotkrueml\Schema\Extension::LANGUAGE_PATH_DEFAULT . ':adminPanel.openGoogleReference',
'iconIdentifier' => 'ext-schema-documentation-google',
],
],
'ImageObject' => [
[
'provider' => 'google',
'link' => 'https://developers.google.com/search/docs/data-types/image-license-metadata',
'title' => Brotkrueml\Schema\Extension::LANGUAGE_PATH_DEFAULT . ':adminPanel.openGoogleReference',
'iconIdentifier' => 'ext-schema-documentation-google',
],
],
'JobPosting' => [
[
'provider' => 'google',
'link' => 'https://developers.google.com/search/docs/data-types/job-posting',
'title' => Brotkrueml\Schema\Extension::LANGUAGE_PATH_DEFAULT . ':adminPanel.openGoogleReference',
'iconIdentifier' => 'ext-schema-documentation-google',
],
],
'MobileApplication' => [
[
'link' => 'https://developers.google.com/search/docs/data-types/software-app',
'title' => Brotkrueml\Schema\Extension::LANGUAGE_PATH_DEFAULT . ':adminPanel.openGoogleReference',
'iconIdentifier' => 'ext-schema-documentation-google',
],
'like' => 'SoftwareApplication',
],
'MonetaryAmountDistribution' => [
[
'provider' => 'google',
'link' => 'https://developers.google.com/search/docs/data-types/estimated-salary',
'title' => Brotkrueml\Schema\Extension::LANGUAGE_PATH_DEFAULT . ':adminPanel.openGoogleReference',
'iconIdentifier' => 'ext-schema-documentation-google',
],
],
'Movie' => [
[
'provider' => 'google',
'link' => 'https://developers.google.com/search/docs/data-types/movie',
'title' => Brotkrueml\Schema\Extension::LANGUAGE_PATH_DEFAULT . ':adminPanel.openGoogleReference',
'iconIdentifier' => 'ext-schema-documentation-google',
],
[
'provider' => 'yandex',
'link' => 'https://yandex.com/support/webmaster/supported-schemas/movie-description.html',
],
],
'NewsArticle' => [
[
'provider' => 'google',
'link' => 'https://developers.google.com/search/docs/data-types/paywalled-content',
'title' => Brotkrueml\Schema\Extension::LANGUAGE_PATH_DEFAULT . ':adminPanel.openGoogleReference',
'iconIdentifier' => 'ext-schema-documentation-google',
],
],
'Organization' => [
[
'provider' => 'yandex',
'link' => 'https://yandex.com/support/webmaster/supported-schemas/address-organization.html',
],
],
'Product' => [
[
'provider' => 'google',
'link' => 'https://developers.google.com/search/docs/data-types/product',
'title' => Brotkrueml\Schema\Extension::LANGUAGE_PATH_DEFAULT . ':adminPanel.openGoogleReference',
'iconIdentifier' => 'ext-schema-documentation-google',
],
[
'provider' => 'yandex',
'link' => 'https://yandex.com/support/webmaster/supported-schemas/goods-prices.html',
],
],
'QAPage' => [
[
'provider' => 'google',
'link' => 'https://developers.google.com/search/docs/data-types/qapage',
'title' => Brotkrueml\Schema\Extension::LANGUAGE_PATH_DEFAULT . ':adminPanel.openGoogleReference',
'iconIdentifier' => 'ext-schema-documentation-google',
],
],
'Question' => [
[
'provider' => 'yandex',
'link' => 'https://yandex.com/support/webmaster/supported-schemas/questions.html',
],
],
'Recipe' => [
[
'provider' => 'google',
'link' => 'https://developers.google.com/search/docs/data-types/recipe',
'title' => Brotkrueml\Schema\Extension::LANGUAGE_PATH_DEFAULT . ':adminPanel.openGoogleReference',
'iconIdentifier' => 'ext-schema-documentation-google',
],
[
'provider' => 'yandex',
'link' => 'https://yandex.com/support/webmaster/supported-schemas/recipe.html',
],
],
'Review' => [
[
'provider' => 'google',
'link' => 'https://developers.google.com/search/docs/data-types/review-snippet',
'title' => Brotkrueml\Schema\Extension::LANGUAGE_PATH_DEFAULT . ':adminPanel.openGoogleReference',
'iconIdentifier' => 'ext-schema-documentation-google',
],
],
'SoftwareApplication' => [
[
'provider' => 'google',
'link' => 'https://developers.google.com/search/docs/data-types/software-app',
'title' => Brotkrueml\Schema\Extension::LANGUAGE_PATH_DEFAULT . ':adminPanel.openGoogleReference',
'iconIdentifier' => 'ext-schema-documentation-google',
],
[
'provider' => 'yandex',
'link' => 'https://yandex.com/support/webmaster/supported-schemas/software.html',
],
],
'Video' => [
'VideoGame' => [
'like' => 'SoftwareApplication',
],
'VideoObject' => [
[
'provider' => 'google',
'link' => 'https://developers.google.com/search/docs/data-types/video',
'title' => Brotkrueml\Schema\Extension::LANGUAGE_PATH_DEFAULT . ':adminPanel.openGoogleReference',
'iconIdentifier' => 'ext-schema-documentation-google',
],
],
'WebApplication' => [
[
'link' => 'https://developers.google.com/search/docs/data-types/software-app',
'title' => Brotkrueml\Schema\Extension::LANGUAGE_PATH_DEFAULT . ':adminPanel.openGoogleReference',
'iconIdentifier' => 'ext-schema-documentation-google',
'provider' => 'yandex',
'link' => 'https://yandex.com/support/video/partners/schema-org.html',
],
],
'WebApplication' => [
'like' => 'SoftwareApplication',
],
];
4 changes: 2 additions & 2 deletions Documentation/AdminPanel/Index.rst
Expand Up @@ -20,8 +20,8 @@ generated by this extension for reviewing:
Types information in the Admin Panel

The icons are linked: The type to the according schema.org documentation and - if
available - to the Google reference for the specific type, other URLs to their
destination.
available - to the Google and Yandex references for the specific type, other
URLs to their destination.

Additionally, you can call Google's Structured Data Testing Tool to validate
the structured data on this page.
Expand Down
5 changes: 4 additions & 1 deletion Resources/Private/Language/locallang.xlf
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.0">
<file source-language="en" datatype="plaintext" original="EXT:schema/Resources/Private/Language/locallang.xlf" date="2020-06-22T16:12:34Z">
<file source-language="en" datatype="plaintext" original="EXT:schema/Resources/Private/Language/locallang.xlf" date="2020-06-27T14:58:02Z">
<body>
<trans-unit id="adminPanel.goToWebsite" resname="adminPanel.goToWebsite">
<source><![CDATA[Go to website]]></source>
Expand All @@ -17,6 +17,9 @@
<trans-unit id="adminPanel.openGoogleReference" resname="adminPanel.openGoogleReference">
<source><![CDATA[Open Google reference for %s]]></source>
</trans-unit>
<trans-unit id="adminPanel.openYandexReference" resname="adminPanel.openYandexReference">
<source><![CDATA[Open Yandex reference for %s]]></source>
</trans-unit>
<trans-unit id="adminPanel.showImage" resname="adminPanel.showImage">
<source><![CDATA[Show image]]></source>
</trans-unit>
Expand Down
1 change: 1 addition & 0 deletions Resources/Public/Icons/documentation-yandex.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f6435d4

Please sign in to comment.