| 1 |
<?php |
| 2 |
|
| 3 |
namespace JFB_Modules\Actions_V2\Insert_Term\Properties; |
| 4 |
|
| 5 |
use Jet_Form_Builder\Actions\Methods\Object_Properties_Collection; |
| 6 |
use Jet_Form_Builder\Classes\Arrayable\Collection; |
| 7 |
use JFB_Modules\Actions_V2\Insert_Term\Insert_Term_Action; |
| 8 |
|
| 9 |
// If this file is called directly, abort. |
| 10 |
if ( ! defined( 'WPINC' ) ) { |
| 11 |
die; |
| 12 |
} |
| 13 |
|
| 14 |
class Term_Modifier extends Abstract_Term_Modifier { |
| 15 |
|
| 16 |
public function is_supported( Insert_Term_Action $action ): bool { |
| 17 |
return true; |
| 18 |
} |
| 19 |
|
| 20 |
public function get_id(): string { |
| 21 |
return 'all'; |
| 22 |
} |
| 23 |
|
| 24 |
public function before_run( Insert_Term_Action $action ) { |
| 25 |
parent::before_run( $action ); |
| 26 |
|
| 27 |
$this->set( 'taxonomy', $action->get_taxonomy() ); |
| 28 |
} |
| 29 |
|
| 30 |
protected function get_properties(): Object_Properties_Collection { |
| 31 |
return apply_filters( |
| 32 |
'jet-form-builder/term-modifier/object-properties', |
| 33 |
new Object_Properties_Collection( |
| 34 |
array( |
| 35 |
new Term_Id_Property(), |
| 36 |
new Term_Taxonomy_Property(), |
| 37 |
new Term_Name_Property(), |
| 38 |
new Term_Slug_Property(), |
| 39 |
new Term_Parent_ID_Property(), |
| 40 |
new Term_Meta_Property(), |
| 41 |
) |
| 42 |
) |
| 43 |
); |
| 44 |
} |
| 45 |
|
| 46 |
public function get_actions(): Collection { |
| 47 |
return apply_filters( |
| 48 |
'jet-form-builder/term-modifier/object-actions', |
| 49 |
new Collection( |
| 50 |
array( |
| 51 |
new Insert_Action(), |
| 52 |
new Update_Action(), |
| 53 |
) |
| 54 |
) |
| 55 |
); |
| 56 |
} |
| 57 |
} |
| 58 |
|