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

[5.1] Article Schemaorg plugin #42402

Merged
merged 14 commits into from
Jan 10, 2024
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `locked`, `manifest_cache`, `params`, `custom_data`, `ordering`, `state`) VALUES
brianteeman marked this conversation as resolved.
Show resolved Hide resolved
(0, 'plg_schemaorg_article', 'plugin', 'article', 'schemaorg', 0, 1, 1, 0, 0, '', '{}', '', 8, 0);
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "locked", "manifest_cache", "params", "custom_data", "ordering", "state") VALUES
(0, 'plg_schemaorg_article', 'plugin', 'article', 'schemaorg', 0, 1, 1, 0, 0, '', '{}', '', 8, 0);
28 changes: 28 additions & 0 deletions administrator/language/en-GB/plg_schemaorg_article.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
; Joomla! Project
; (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
; License GNU General Public License version 2 or later; see LICENSE.txt
; Note : All ini files need to be saved as UTF-8

PLG_SCHEMAORG_ARTICLE="Schema.org - Article"
PLG_SCHEMAORG_ARTICLE_DESCRIPTION_LABEL="More information on the Schema.org Article Type can be found at <a href=\"https://schema.org/Article\" target=\"_blank\" rel=\"noopener noreferrer\">https://schema.org/Article</a>"
PLG_SCHEMAORG_ARTICLE_FIELD_ADDRESS_LABEL="Address"
PLG_SCHEMAORG_ARTICLE_FIELD_AUTHOR_LABEL="Author"
PLG_SCHEMAORG_ARTICLE_FIELD_DATE_MODIFIED_LABEL="Date Modified"
PLG_SCHEMAORG_ARTICLE_FIELD_DATE_PUBLISHED_LABEL="Date Published"
PLG_SCHEMAORG_ARTICLE_FIELD_DESCRIPTION_LABEL="Description"
PLG_SCHEMAORG_ARTICLE_FIELD_EMAIL_LABEL="Email"
PLG_SCHEMAORG_ARTICLE_FIELD_GENERIC_FIELD_LABEL="Generic Field"
PLG_SCHEMAORG_ARTICLE_FIELD_GENERIC_TITLE_LABEL="Title"
PLG_SCHEMAORG_ARTICLE_FIELD_GENERIC_VALUE_LABEL="Value"
PLG_SCHEMAORG_ARTICLE_FIELD_HEADLINE_LABEL="Headline"
PLG_SCHEMAORG_ARTICLE_FIELD_IMAGE_LABEL="Image"
PLG_SCHEMAORG_ARTICLE_FIELD_LOCALITY_LABEL="Locality"
PLG_SCHEMAORG_ARTICLE_FIELD_LOGO_LABEL="Logo"
PLG_SCHEMAORG_ARTICLE_FIELD_NAME_LABEL="Name"
PLG_SCHEMAORG_ARTICLE_FIELD_ORGANIZATION_LABEL="Organization"
PLG_SCHEMAORG_ARTICLE_FIELD_PERSON_LABEL="Person"
PLG_SCHEMAORG_ARTICLE_FIELD_POSTAL_CODE_LABEL="Postal Code"
PLG_SCHEMAORG_ARTICLE_FIELD_STREET_ADDRESS_LABEL="Street Address"
PLG_SCHEMAORG_ARTICLE_FIELD_TYPE_LABEL="Type"
PLG_SCHEMAORG_ARTICLE_FIELD_URL_LABEL="Url"
PLG_SCHEMAORG_ARTICLE_XML_DESCRIPTION="Adds Article as a new schema type in existing schemas."
7 changes: 7 additions & 0 deletions administrator/language/en-GB/plg_schemaorg_article.sys.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
; Joomla! Project
; (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
; License GNU General Public License version 2 or later; see LICENSE.txt
; Note : All ini files need to be saved as UTF-8

PLG_SCHEMAORG_ARTICLE="Schema.org - Article"
PLG_SCHEMAORG_ARTICLE_XML_DESCRIPTION="Adds Article as a new schema type in existing schemas."
1 change: 1 addition & 0 deletions installation/sql/mysql/base.sql
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`,
(0, 'plg_schemaorg_person', 'plugin', 'person', 'schemaorg', 0, 1, 1, 0, 0, '', '{}', '', 5, 0),
(0, 'plg_schemaorg_recipe', 'plugin', 'recipe', 'schemaorg', 0, 1, 1, 0, 0, '', '{}', '', 6, 0),
(0, 'plg_schemaorg_jobposting', 'plugin', 'jobposting', 'schemaorg', 0, 1, 1, 0, 0, '', '{}', '', 7, 0),
(0, 'plg_schemaorg_article', 'plugin', 'article', 'schemaorg', 0, 1, 1, 0, 0, '', '{}', '', 8, 0),
brianteeman marked this conversation as resolved.
Show resolved Hide resolved
(0, 'plg_system_accessibility', 'plugin', 'accessibility', 'system', 0, 0, 1, 0, 1, '', '{}', '', 1, 0),
(0, 'plg_system_actionlogs', 'plugin', 'actionlogs', 'system', 0, 1, 1, 0, 1, '', '{}', '', 2, 0),
(0, 'plg_system_cache', 'plugin', 'cache', 'system', 0, 0, 1, 0, 1, '', '{"browsercache":"0","cachetime":"15"}', '', 3, 0),
Expand Down
1 change: 1 addition & 0 deletions installation/sql/postgresql/base.sql
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder",
(0, 'plg_schemaorg_person', 'plugin', 'person', 'schemaorg', 0, 1, 1, 0, 0, '', '{}', '', 5, 0),
(0, 'plg_schemaorg_recipe', 'plugin', 'recipe', 'schemaorg', 0, 1, 1, 0, 0, '', '{}', '', 6, 0),
(0, 'plg_schemaorg_jobposting', 'plugin', 'jobposting', 'schemaorg', 0, 1, 1, 0, 0, '', '{}', '', 7, 0),
(0, 'plg_schemaorg_article', 'plugin', 'article', 'schemaorg', 0, 1, 1, 0, 0, '', '{}', '', 8, 0),
(0, 'plg_system_accessibility', 'plugin', 'accessibility', 'system', 0, 0, 1, 0, 1, '', '{}', '', 1, 0),
(0, 'plg_system_actionlogs', 'plugin', 'actionlogs', 'system', 0, 1, 1, 0, 1, '', '{}', '', 2, 0),
(0, 'plg_system_cache', 'plugin', 'cache', 'system', 0, 0, 1, 0, 1, '', '{"browsercache":"0","cachetime":"15"}', '', 3, 0),
Expand Down
1 change: 1 addition & 0 deletions libraries/src/Extension/ExtensionHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ class ExtensionHelper
['plugin', 'multilang', 'sampledata', 0],

// Core plugin extensions - schemaorg
['plugin', 'article', 'schemaorg', 0],
['plugin', 'blogposting', 'schemaorg', 0],
['plugin', 'book', 'schemaorg', 0],
['plugin', 'event', 'schemaorg', 0],
Expand Down
43 changes: 43 additions & 0 deletions plugins/schemaorg/article/article.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="plugin" group="schemaorg" method="upgrade">
<name>plg_schemaorg_article</name>
<author>Joomla! Project</author>
<creationDate>2023-12</creationDate>
<copyright>(C) 2023 Open Source Matters, Inc.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>5.0.0</version>
brianteeman marked this conversation as resolved.
Show resolved Hide resolved
<description>PLG_SCHEMAORG_ARTICLE_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\Schemaorg\Article</namespace>
<files>
<folder plugin="article">services</folder>
<folder>src</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_schemaorg_article.ini</language>
<language tag="en-GB">language/en-GB/plg_schemaorg_article.sys.ini</language>
</languages>
<config>
<fields name="params">
<fieldset name="basic">
<field
name="allowedlist"
type="SchemaorgComponentSections"
label="JSCHEMAORG_EXTENSION_ALLOWED_LABEL"
description="JSCHEMAORG_EXTENSION_ALLOWED_DESCRIPTION"
multiple="multiple"
layout="joomla.form.field.list-fancy-select"
/>
<field
name="forbiddenlist"
type="SchemaorgComponentSections"
label="JSCHEMAORG_EXTENSION_FORBIDDEN_LABEL"
description="JSCHEMAORG_EXTENSION_FORBIDDEN_DESCRIPTION"
multiple="multiple"
layout="joomla.form.field.list-fancy-select"
/>
</fieldset>
</fields>
</config>
</extension>
199 changes: 199 additions & 0 deletions plugins/schemaorg/article/forms/schemaorg.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
<?xml version="1.0" encoding="UTF-8"?>
<form>
<fields name="schema">
<fieldset
name="schema"
label="PLG_SYSTEM_SCHEMA_FIELD_SCHEMA_LABEL"
>
<field
name="Article"
type="subform"
showon="schemaType:Article"
>
<form>

<field
name="@type"
type="hidden"
default="Article"
/>

<field
name="noteArticle"
type="note"
description="PLG_SCHEMAORG_ARTICLE_DESCRIPTION_LABEL"
class="alert alert-info w-100"
/>

<field
name="image"
type="media"
label="PLG_SCHEMAORG_ARTICLE_FIELD_IMAGE_LABEL"
/>

<field
name="headline"
type="text"
label="PLG_SCHEMAORG_ARTICLE_FIELD_HEADLINE_LABEL"
filter="string"
size="30"
/>

<field
name="description"
type="text"
label="PLG_SCHEMAORG_ARTICLE_FIELD_DESCRIPTION_LABEL"
filter="string"
/>

<field
name="author"
type="subform"
label="PLG_SCHEMAORG_ARTICLE_FIELD_AUTHOR_LABEL"
>
<form>

<field
name="@type"
type="list"
label="PLG_SCHEMAORG_ARTICLE_FIELD_TYPE_LABEL"
default="person"
>
<option value="person">PLG_SCHEMAORG_ARTICLE_FIELD_PERSON_LABEL</option>
<option value="organization">PLG_SCHEMAORG_ARTICLE_FIELD_ORGANIZATION_LABEL</option>
</field>

<field
name="name"
type="text"
label="PLG_SCHEMAORG_ARTICLE_FIELD_NAME_LABEL"
filter="string"
/>

<field
name="url"
type="url"
label="PLG_SCHEMAORG_ARTICLE_FIELD_URL_LABEL"
filter="url"
validate="url"
/>

<field
name="logo"
type="subform"
label="PLG_SCHEMAORG_ARTICLE_FIELD_LOGO_LABEL"
showon="@type:organization"
>
<form>

<field
name="@type"
type="hidden"
default="ImageObject"
/>

<field
name="url"
type="media"
label="PLG_SCHEMAORG_ARTICLE_FIELD_URL_LABEL"
/>

</form>
</field>

<field
name="email"
type="email"
label="PLG_SCHEMAORG_ARTICLE_FIELD_EMAIL_LABEL"
validate="email"
/>

<field
name="address"
type="subform"
label="PLG_SCHEMAORG_ARTICLE_FIELD_ADDRESS_LABEL"
>
<form>

<field
name="@type"
type="hidden"
default="PostalAddress"
/>

<field
name="addressLocality"
type="text"
label="PLG_SCHEMAORG_ARTICLE_FIELD_LOCALITY_LABEL"
/>

<field
name="postalCode"
type="text"
label="PLG_SCHEMAORG_ARTICLE_FIELD_POSTAL_CODE_LABEL"
/>

<field
name="streetAddress"
type="text"
label="PLG_SCHEMAORG_ARTICLE_FIELD_STREET_ADDRESS_LABEL"
/>

</form>
</field>

</form>
</field>

<field
name="datePublished"
type="calendar"
label="PLG_SCHEMAORG_ARTICLE_FIELD_DATE_PUBLISHED_LABEL"
class="input-small"
filter="user_utc"
showtime="false"
todaybutton="true"
translateformat="true"
/>

<field
name="dateModified"
type="calendar"
label="PLG_SCHEMAORG_ARTICLE_FIELD_DATE_MODIFIED_LABEL"
class="input-small"
filter="user_utc"
showtime="false"
todaybutton="true"
translateformat="true"
/>

<field
name="genericField"
type="subform"
label="PLG_SCHEMAORG_ARTICLE_FIELD_GENERIC_FIELD_LABEL"
multiple="true"
>
<form>
<field
name="genericTitle"
type="text"
label="PLG_SCHEMAORG_ARTICLE_FIELD_GENERIC_TITLE_LABEL"
filter="string"
size="30"
/>
<field
name="genericValue"
type="text"
filter="string"
size="30"
label="PLG_SCHEMAORG_ARTICLE_FIELD_GENERIC_VALUE_LABEL"
/>
</form>

</field>

</form>
</field>
</fieldset>
</fields>
</form>
47 changes: 47 additions & 0 deletions plugins/schemaorg/article/services/provider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

/**
* @package Joomla.Plugin
* @subpackage Schemaorg.article
*
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

\defined('_JEXEC') or die;

use Joomla\CMS\Extension\PluginInterface;
use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Plugin\Schemaorg\Article\Extension\Article;

return new class () implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 5.0.0
brianteeman marked this conversation as resolved.
Show resolved Hide resolved
*/
public function register(Container $container)
{
$container->set(
PluginInterface::class,
function (Container $container) {
$dispatcher = $container->get(DispatcherInterface::class);
$plugin = new Article(
$dispatcher,
(array) PluginHelper::getPlugin('schemaorg', 'article')
);
$plugin->setApplication(Factory::getApplication());

return $plugin;
}
);
}
};
Loading