You are here

public static function SchemaActionTrait::actionProperties in Schema.org Metatag 8

Return an array of the unique properties for an action type.

Parameters

string $action_type: The type of action. Use an action name for properties specific to that action type. Use 'All' for general properties that apply to all actions.

Return value

array An array of all the unique properties for that type.

1 call to SchemaActionTrait::actionProperties()
SchemaActionTrait::actionForm in src/Plugin/metatag/Tag/SchemaActionTrait.php
Create the form element.

File

src/Plugin/metatag/Tag/SchemaActionTrait.php, line 429

Class

SchemaActionTrait
Schema.org Action trait.

Namespace

Drupal\schema_metatag\Plugin\metatag\Tag

Code

public static function actionProperties($action_type) {
  switch ($action_type) {
    case 'MoveAction':
    case 'TransferAction':
      return [
        'fromLocation' => [
          'class' => 'SchemaPlaceBase',
          'form' => 'placeForm',
          'description' => "A sub property of location. The original location of the object or the agent before the action.",
        ],
        'toLocation' => [
          'class' => 'SchemaPlaceBase',
          'form' => 'placeForm',
          'description' => "A sub property of location. The final location of the object or the agent after the action.",
        ],
      ];
    case 'TradeAction':
      return [
        'target' => [
          'class' => 'SchemaEntryPointBase',
          'form' => 'entryPointForm',
          'description' => "Indicates a target EntryPoint for an Action.",
        ],
      ];
    case 'ConsumeAction':
      return [
        'target' => [
          'class' => 'SchemaEntryPointBase',
          'form' => 'entryPointForm',
          'description' => "Indicates a target EntryPoint for an Action.",
        ],
        'expectsAcceptanceOf' => [
          'class' => 'SchemaOfferBase',
          'form' => 'offerForm',
          'description' => "An Offer which must be accepted before the user can perform the Action. For example, the user may need to buy a movie before being able to watch it.",
        ],
      ];
    case 'OrganizeAction':
      return [
        'target' => [
          'class' => 'SchemaEntryPointBase',
          'form' => 'entryPointForm',
          'description' => "Indicates a target EntryPoint for an Action.",
        ],
        'result' => [
          'class' => 'SchemaThingBase',
          'form' => 'thingForm',
          'description' => "The result produced in the action. e.g. John wrote a book.",
        ],
      ];
    case 'InteractAction':
    case 'PlayAction':
      return [
        'event' => [
          'class' => 'SchemaEventBase',
          'form' => 'eventForm',
          'description' => "Upcoming or past event associated with this place, organization, or action.",
        ],
      ];
    case 'SearchAction':
      return [
        'query' => [
          'class' => 'SchemaNameBase',
          'form' => '',
          'description' => "The query used on this action, i.e. https://query.example.com/search?q={search_term_string}.",
        ],
        'query-input' => [
          'class' => 'SchemaNameBase',
          'form' => '',
          'description' => "The placeholder for the query, i.e. required name=search_term_string.",
        ],
        'target' => [
          'class' => 'SchemaEntryPointBase',
          'form' => 'entryPointForm',
          'description' => "Indicates a target EntryPoint for an Action.",
        ],
      ];
    case 'UpdateAction':
      return [
        'targetCollection' => [
          'class' => 'SchemaThingBase',
          'form' => 'thingForm',
          'description' => "The collection target of the action.",
        ],
      ];
    case 'All':
      return [];

    // General properties that apply to all actions.
    case 'Other':
      return [
        'price' => [
          'class' => 'SchemaNameBase',
          'form' => '',
          'description' => "The offer price of a product, or of a price component.",
        ],
        'buyer' => [
          'class' => 'SchemaPersonOrgBase',
          'form' => 'personOrgForm',
          'description' => "The participant/person/organization that bought the object.",
        ],
        'seller' => [
          'class' => 'SchemaPersonOrgBase',
          'form' => 'personOrgForm',
          'description' => "An entity which offers (sells / leases / lends / loans) the services / goods. A seller may also be a provider.",
        ],
        'recipient' => [
          'class' => 'SchemaPersonOrgBase',
          'form' => 'personOrgForm',
          'description' => "The participant who is at the receiving end of the action.",
        ],
        'target' => [
          'class' => 'SchemaEntryPointBase',
          'form' => 'entryPointForm',
          'description' => "Indicates a target EntryPoint for an Action.",
        ],
        'result' => [
          'class' => 'SchemaThingBase',
          'form' => 'thingForm',
          'description' => "The result produced in the action. e.g. John wrote a book.",
        ],
        'agent' => [
          'class' => 'SchemaPersonOrgBase',
          'form' => 'personOrgForm',
          'description' => "The direct performer or driver of the action (animate or inanimate). e.g. John wrote a book.",
        ],
        'instrument' => [
          'class' => 'SchemaThingBase',
          'form' => 'thingForm',
          'description' => "The object that helped the agent perform the action. e.g. John wrote a book with a pen.",
        ],
        'participant' => [
          'class' => 'SchemaPersonOrgBase',
          'form' => 'personOrgForm',
          'description' => "Other co-agents that participated in the action indirectly. e.g. John wrote a book with Steve.",
        ],
        'object' => [
          'class' => 'SchemaThingBase',
          'form' => 'thingForm',
          'description' => "The object upon which the action is carried out, whose state is kept intact or changed. Also known as the semantic roles patient, affected or undergoer (which change their state) or theme (which doesn't). e.g. John read a book.",
        ],
        'error' => [
          'class' => 'SchemaThingBase',
          'form' => 'thingForm',
          'description' => "For failed actions, more information on the cause of the failure.",
        ],
        'location' => [
          'class' => 'SchemaPlaceBase',
          'form' => 'placeForm',
          'description' => "The location of for example where the event is happening, an organization is located, or where an action takes place.",
        ],
        'startTime' => [
          'class' => 'SchemaNameBase',
          'form' => '',
          'description' => "The startTime of something. For a reserved event or service (e.g. FoodEstablishmentReservation), the time that it is expected to start. For actions that span a period of time, when the action was performed. e.g. John wrote a book from January to December.",
        ],
        'endTime' => [
          'class' => 'SchemaNameBase',
          'form' => '',
          'description' => "The endTime of something. For a reserved event or service (e.g. FoodEstablishmentReservation), the time that it is expected to end. For actions that span a period of time, when the action was performed. e.g. John wrote a book from January to December.",
        ],
      ];
    default:
      return [];
  }
}