brotkrueml/schema-virtuallocation

Add-on to the TYPO3 schema extension, providing pending type VirtualLocation

Installs: 336

Dependents: 0

Suggesters: 1

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:typo3-cms-extension

v1.1.0 2020-12-28 10:44 UTC

This package is auto-updated.

Last update: 2021-03-28 11:31:24 UTC


README

This extension is an add-on for the TYPO3 schema extension and provides the VirtualLocation type. It can be assigned as location to the Event type. As it is a pending type by now it is not provided by the schema extension. When this type is taken into the core vocabulary this extension is obsolete.

Also this extension serves as a blueprint for extending the schema extension with own type models and view helpers.

Requirements

The extension works with TYPO3 v9 LTS, TYPO3 v10 LTS and TYPO3 v11. It requires at least the schema extension version 1.7.

Installation

With composer:

composer req brotkrueml/schema-virtuallocation

Usage

Using the API

$location = \Brotkrueml\Schema\Type\TypeFactory::createType('VirtualLocation');
$location->setProperty('url', 'https://example.org/join/12345');

$event = \Brotkrueml\Schema\Type\TypeFactory::createType('Event');
$event
    ->setProperty('name' 'A virtual event')
    ->setProperty('location', $location)
;

Using the View Helpers

<schema:type.event name="A virtual event">
    <schema:type.virtualLocation
        -as="location"
        url="https://example.org/join/12345"
    />
</schema:type.event>

Both cases produce the following JSON-LD ouput:

{
    "@context": "http://schema.org",
    "@type": "Event",
    "location": {
        "@type": "VirtualLocation",
        "url": "https://example.org/join/12345"
    },
    "name": "A virtual event"
}

For more information have a look into the schema documentation.