You are here

function hook_schema_metatag_property_type_plugins_alter in Schema.org Metatag 8.2

Adjust Schema Metatags property types.

Use hook_schema_metatag_property_type_plugins_alter() to change property type information.

Parameters

array $definitions: An array of the property type definitions.

1 invocation of hook_schema_metatag_property_type_plugins_alter()
PropertyTypeManager::__construct in src/Plugin/schema_metatag/PropertyTypeManager.php
Constructs a new PropertyTypeManager object.

File

./schema_metatag.api.php, line 50
Document all supported APIs.

Code

function hook_schema_metatag_property_type_plugins_alter(&$definitions) {

  // Change the Place property type to use plain text instead of the structured
  // PostalAddress and GeoCoordinates used as a default.
  $definitions['place']['property_type'] = 'Text';
  $definitions['place']['tree_parent'] = [];
  $definitions['place']['tree_depth'] = -1;
  $definitions['place']['sub_properties'] = [];

  // Update the CreativeWork property type to add an author sub-property to all
  // properties that use this property type.
  $definitions['creative_work']['sub_properties'] += [
    'author' => [
      'id' => 'person',
      'label' => t('author'),
      'description' => t('The person who created this.'),
      'tree_parent' => [
        'Person',
      ],
      'tree_depth' => 0,
    ],
  ];
}