|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Leonidas\Library\System; |
|
4
|
|
|
|
|
5
|
|
|
use Leonidas\Contracts\System\BaseSystemModelTypeInterface; |
|
6
|
|
|
use UnexpectedValueException; |
|
7
|
|
|
|
|
8
|
|
|
abstract class AbstractSystemModelTypeRegistrar |
|
9
|
|
|
{ |
|
10
|
|
|
protected function unregisteredOptionException(string $option): UnexpectedValueException |
|
11
|
|
|
{ |
|
12
|
|
|
return new UnexpectedValueException( |
|
13
|
|
|
"There is no registered handler for option \"{$option}\" provided." |
|
14
|
|
|
); |
|
15
|
|
|
} |
|
16
|
|
|
|
|
17
|
|
|
protected function getBaseArgs(BaseSystemModelTypeInterface $type): array |
|
18
|
|
|
{ |
|
19
|
|
|
return [ |
|
20
|
|
|
'labels' => $type->getLabels(), |
|
21
|
|
|
'description' => $type->getDescription(), |
|
22
|
|
|
'public' => $type->isPublic(), |
|
23
|
|
|
'hierarchical' => $type->isHierarchical(), |
|
24
|
|
|
'publicly_queryable' => $type->isPubliclyQueryable(), |
|
25
|
|
|
'show_ui' => $type->isShownInUi(), |
|
26
|
|
|
'show_in_menu' => $type->getShownInMenu(), |
|
27
|
|
|
'show_in_nav_menus' => $type->isShownInNavMenus(), |
|
28
|
|
|
'capabilities' => $type->getCapabilities(), |
|
29
|
|
|
'rewrite' => $type->getRewrite(), |
|
30
|
|
|
'query_var' => $type->getQueryVar(), |
|
31
|
|
|
'show_in_rest' => $type->isShownInRest(), |
|
32
|
|
|
'rest_base' => $type->getRestBase(), |
|
33
|
|
|
'rest_namespace' => $type->getRestNamespace(), |
|
34
|
|
|
'rest_controller_class' => $type->getRestControllerClass(), |
|
35
|
|
|
]; |
|
36
|
|
|
} |
|
37
|
|
|
} |
|
38
|
|
|
|