1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
use Leonidas\Library\Admin\Fields\TermChecklist; |
|
|
|
|
4
|
|
|
use Leonidas\Library\Admin\Fields\TermSelect; |
|
|
|
|
5
|
|
|
use Leonidas\Library\Admin\Fields\TermSelect2; |
|
|
|
|
6
|
|
|
use Leonidas\Library\Admin\Forms\Controllers\PostMetaboxFormSubmissionManager; |
|
|
|
|
7
|
|
|
use Leonidas\Library\Admin\Loaders\Screen; |
|
|
|
|
8
|
|
|
use Leonidas\Library\Admin\Metabox\AutoLoadingMetabox; |
|
|
|
|
9
|
|
|
use Leonidas\Library\Admin\Metabox\Components\Field; |
|
|
|
|
10
|
|
|
use Leonidas\Library\Core\Auth\Nonce; |
11
|
|
|
|
12
|
|
|
Screen::load('post', ['post_type' => 'wts_test_cpt_2'], function () { |
13
|
|
|
// exit(var_dump($_POST)); |
14
|
|
|
|
15
|
|
|
################################################################################ |
16
|
|
|
# Base |
17
|
|
|
################################################################################ |
18
|
|
|
$test = 'Taxonomy Checklist'; |
19
|
|
|
$postType = 'wts_test_cpt_2'; |
20
|
|
|
$taxonomy = 'wts_test_tax'; |
21
|
|
|
$taxName = get_taxonomy($taxonomy)->labels->name; |
|
|
|
|
22
|
|
|
|
23
|
|
|
$nonce = new Nonce('selection-nonce', 'save-selection'); |
24
|
|
|
|
25
|
|
|
$metabox = (new AutoLoadingMetabox('selections-metabox', 'Selections Tests', $postType)) |
26
|
|
|
->setNonce($nonce) |
27
|
|
|
->hook(); |
28
|
|
|
|
29
|
|
|
$manager = (new PostMetaboxFormSubmissionManager($postType)) |
30
|
|
|
->setTokenManager($nonce) |
31
|
|
|
->hook(); |
32
|
|
|
|
33
|
|
|
################################################################################ |
34
|
|
|
# Checklist |
35
|
|
|
################################################################################ |
36
|
|
|
$checklist = new TermChecklist($taxonomy, 'wts_tax_input'); |
37
|
|
|
$checklistField = (new Field($checklist))->setLabel($test); |
38
|
|
|
|
39
|
|
|
$manager->addField($checklist); |
40
|
|
|
$metabox->addContent('taxonomy-checklist', $checklistField); |
41
|
|
|
|
42
|
|
|
################################################################################ |
43
|
|
|
# Post Query Select Options |
44
|
|
|
################################################################################ |
45
|
|
|
$options = [ |
46
|
|
|
'multiple' => true, |
47
|
|
|
'class' => ['regular-text'], |
48
|
|
|
]; |
49
|
|
|
|
50
|
|
|
$select = new TermSelect($taxonomy, 'wts_tax_input_2', $options); |
51
|
|
|
$selectField = (new Field($select))->setLabel('Taxonomy Select'); |
52
|
|
|
|
53
|
|
|
$manager->addField($select); |
54
|
|
|
$metabox->addContent('taxonomy-select', $selectField); |
55
|
|
|
|
56
|
|
|
################################################################################ |
57
|
|
|
# Term Select2 |
58
|
|
|
################################################################################ |
59
|
|
|
$options = [ |
60
|
|
|
'multiple' => true, |
61
|
|
|
]; |
62
|
|
|
|
63
|
|
|
$select2 = new TermSelect2($taxonomy, 'wts_tax_input_3', $options); |
64
|
|
|
$select2Field = (new Field($select2))->setLabel('Taxonomy Select2'); |
65
|
|
|
|
66
|
|
|
$manager->addField($select2); |
67
|
|
|
$metabox->addContent('taxonomy-select2', $select2Field); |
68
|
|
|
}); |
69
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths