<?php
|
namespace JVBase\managers\SEO\render\Traits\_Properties;
|
|
use JVBase\inc\managers\SEO\render\Thing\Action\Action;
|
use JVBase\managers\SEO\render\Traits\_Helpers\arrayHelper;
|
|
if (!defined('ABSPATH')) {
|
exit;
|
}
|
trait potentialActionTrait {
|
use arrayHelper;
|
/**
|
* @var Action|array Indicates a potential Action, which describes an idealized action in which this thing would play an 'object' role.
|
*/
|
protected Action|array $potentialAction;
|
|
public function getPotentialAction():Action|array|null
|
{
|
return $this->potentialAction??null;
|
}
|
public function setPotentialAction(Action|array $potentialAction):void
|
{
|
if (is_array($potentialAction)) {
|
$potentialAction = $this->classArray('potentialAction', $potentialAction, 'JVBase\inc\managers\SEO\render\Thing\Action\Action');
|
$potentialAction = array_map(
|
function ($item) {
|
$target = $item->getTarget();
|
$url = $target->getUrlTemplate();
|
$target->setId($url.'#entrypoint');
|
|
return $item;
|
},
|
$potentialAction
|
);
|
if (empty($potentialAction)) {
|
return;
|
}
|
}
|
$this->potentialAction = $potentialAction;
|
}
|
|
public function getPotentialActionFieldConfig():array
|
{
|
return [
|
'type' => 'repeater',
|
'label' => 'Potential Action',
|
'fields' => [
|
'type' => [
|
'type' => 'select',
|
'label' => 'Action Type',
|
'options' => [
|
'AchieveAction' => 'Achieve Action',
|
'LoseAction' => ' - Lose Action',
|
'TieAction' => ' - Tie Action',
|
'WinAction' => ' - Win Action',
|
'AssessAction' => 'Assess Action',
|
'ChooseAction' => ' - Choose Action',
|
'IgnoreAction' => ' - Ignore Action',
|
'ReactAction' => ' - React Action',
|
'ReviewAction' => ' - Review Action',
|
'ConsumeAction' => 'Consume Action',
|
'DrinkAction' => ' - Drink Action',
|
'EatAction' => ' - Eat Action',
|
'InstallAction' => ' - Install Action',
|
'ListenAction' => ' - Listen Action',
|
'PlayGameAction' => ' - PlayGame Action',
|
'ReadAction' => ' - Read Action',
|
'UseAction' => ' - Use Action',
|
'ViewAction' => ' - View Action',
|
'WatchAction' => ' - Watch Action',
|
'ControlAction' => 'Control Action',
|
'ActivateAction' => ' - Activate Action',
|
'AuthenticateAction' => ' - Authenticate Action',
|
'DeactivateAction' => ' - Deactivate Action',
|
'LoginAction' => ' - Login Action',
|
'ResetPasswordAction' => ' - ResetPassword Action',
|
'ResumeAction' => ' - Resume Action',
|
'SuspendAction' => ' - Suspend Action',
|
'CreateAction' => 'Create Action',
|
'CookAction' => ' - Cook Action',
|
'DrawAction' => ' - Draw Action',
|
'FilmAction' => ' - Film Action',
|
'PaintAction' => ' - Paint Action',
|
'PhotographAction' => ' - Photograph Action',
|
'WriteAction' => ' - Write Action',
|
'FindAction' => 'Find Action',
|
'CheckAction' => ' - Check Action',
|
'DiscoverAction' => ' - Discover Action',
|
'TrackAction' => ' - Track Action',
|
'InteractAction'=> 'Interact Action',
|
'BefriendAction'=> ' - Befriend Action',
|
'CommunicateAction'=> ' - Communicate Action',
|
'Follow Action'=> ' - Follow Action',
|
'JoinAction'=> ' - Join Action',
|
'LeaveAction'=> ' - Leave Action',
|
'MarryAction'=> ' - Marry Action',
|
'RegisterAction'=> ' - Register Action',
|
'SubscribeAction'=> ' - Subscribe Action',
|
'UnRegisterAction'=> ' - Unregister Action',
|
'MoveAction' => 'Move Action',
|
'ArriveAction' => ' - Arrive Action',
|
'DepartAction' => ' - Depart Action',
|
'TravelAction' => ' - Travel Action',
|
'OrganizeAction'=> 'Organize Action',
|
'AllocateAction'=> ' - Allocate Action',
|
'ApplyAction'=> ' - Apply Action',
|
'BookmarkAction'=> ' - Bookmark Action',
|
'PlanAction'=> ' - Plan Action',
|
'PlayAction' => 'Play Action',
|
'ExerciseAction' => ' - Exercise Action',
|
'PerformAction' => ' - Perform Action',
|
'SearchAction' => 'Search Action',
|
'SeekToAction' => 'Seek To Action',
|
'TradeAction' => 'Trade Action',
|
'BuyAction' => ' - Buy Action',
|
'OrderAction' => ' - Order Action',
|
'PayAction' => ' - Pay Action',
|
'PreOrderAction' => ' - PreOrder Action',
|
'QuoteAction' => ' - Quote Action',
|
'RentAction' => ' - Rent Action',
|
'SellAction' => ' - Sell Action',
|
'TipAction' => ' - Tip Action',
|
'TransferAction'=> 'Transfer Action',
|
'BorrowAction'=> ' - Borrow Action',
|
'DonateAction'=> ' - Donate Action',
|
'DownloadAction'=> ' - Download Action',
|
'GiveAction'=> ' - Give Action',
|
'LendAction'=> ' - Lend Action',
|
'MoneyAction'=> ' - Money Transfer',
|
'ReceiveAction'=> ' - Receive Action',
|
'ReturnAction'=> ' - Return Action',
|
'SendAction'=> ' - Send Action',
|
'TakeAction'=> ' - Take Action',
|
'UpdateAction' => 'Update Action',
|
'AddAction' => ' - Add Action',
|
'DeleteAction' => ' - Delete Action',
|
'ReplaceAction' => ' - Replace Action',
|
]
|
],
|
'name' => [
|
'type' => 'text',
|
'label' => 'Name',
|
'required' => true,
|
'hint' => 'Example: "Search", "Contact Us"'
|
],
|
'target' => [
|
'type' => 'text',
|
'label' => 'Target',
|
'required' => true,
|
'hint' => 'The URL where this action takes place.'
|
],
|
'description' => [
|
'type' => 'textarea',
|
'label' => 'Description',
|
]
|
]
|
];
|
}
|
}
|