-
-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathMslsCustomColumnTaxonomy.php
More file actions
48 lines (40 loc) · 1.07 KB
/
MslsCustomColumnTaxonomy.php
File metadata and controls
48 lines (40 loc) · 1.07 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php declare( strict_types=1 );
namespace lloc\Msls;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Handling of existing/not existing translations in the backend
* listings of various taxonomies
*
* @package Msls
*/
final class MslsCustomColumnTaxonomy extends MslsCustomColumn {
protected function add_hooks(): void {
if ( $this->options->is_excluded() ) {
return;
}
$taxonomy = msls_taxonomy()->get_request();
if ( ! empty( $taxonomy ) ) {
add_filter( "manage_edit-{$taxonomy}_columns", array( $this, 'th' ) );
add_action( "manage_{$taxonomy}_custom_column", array( $this, 'column_default' ), - 100, 3 );
add_action( "delete_{$taxonomy}", array( $this, 'delete' ) );
}
}
/**
* @param string $deprecated
* @param string $column_name
* @param int $item_id
*/
public function column_default( $deprecated, $column_name, $item_id ): void {
$this->td( $column_name, $item_id );
}
/**
* @codeCoverageIgnore
*
* @param int $object_id
*/
public function delete( $object_id ): void {
$this->save( $object_id, MslsOptionsTax::class );
}
}