Jake Vanderwerf
3 days ago ba1e1ccf869b818f7a7a897264dfea05563a7796
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
namespace JVBase\managers\SEO\render\Traits\_Properties;
 
use JVBase\base\SchemaHelper;
use JVBase\managers\SEO\render\Thing\Intangible\EntryPoint;
 
if (!defined('ABSPATH')) {
    exit;
}
trait targetTrait {
    /**
     * @var EntryPoint Indicates a target EntryPoint, or url, for an Action.
     */
    protected EntryPoint $target;
 
    public function getTarget():EntryPoint|null
    {
        return $this->target??null;
    }
    public function setTarget(EntryPoint|string $target):void
    {
        if (is_string($target)) {
            if (str_starts_with($target, '/')) {
                $target = home_url().$target;
            }
            $temp = [
                'type'  => 'JVBase\managers\SEO\render\Thing\Intangible\EntryPoint',
                'urlTemplate'   => $target
            ];
            $target = SchemaHelper::classFromConfig($temp);
        }
        $this->target = $target;
    }
}