1 | <?php |
||
5 | trait ClassNameAsPostType |
||
6 | { |
||
7 | /** |
||
8 | * Class name derived post type identifiers |
||
9 | * @var array className => post_type |
||
10 | */ |
||
11 | protected static $classNamePostType = []; |
||
12 | |||
13 | /** |
||
14 | * Get the post type identifier for this model |
||
15 | * |
||
16 | * This method overloads the constant-based default, allowing for |
||
17 | * a convenient alternative to hard-coding the post type. |
||
18 | * The POST_TYPE constant must take precedence over the derived name, if set. |
||
19 | * |
||
20 | * @return string post type identifier (slug) |
||
21 | */ |
||
22 | public static function postTypeId() |
||
30 | |||
31 | /** |
||
32 | * Get the post type id from the class name |
||
33 | * |
||
34 | * @return string |
||
35 | */ |
||
36 | protected static function getPostTypeFromName() |
||
58 | } |
||
59 |