| 1 |
<?php |
| 2 |
|
| 3 |
namespace RadiusTheme\SB\Modules\Compare; |
| 4 |
|
| 5 |
// Do not allow directly accessing this file. |
| 6 |
if ( ! defined( 'ABSPATH' ) ) { |
| 7 |
exit( 'This script cannot be accessed directly.' ); |
| 8 |
} |
| 9 |
|
| 10 |
use RadiusTheme\SB\Helpers\Fns; |
| 11 |
use RadiusTheme\SB\Traits\SingletonTrait; |
| 12 |
use WP_Post; |
| 13 |
|
| 14 |
class CompareAdmin { |
| 15 |
|
| 16 |
use SingletonTrait; |
| 17 |
|
| 18 |
public function __construct() { |
| 19 |
add_filter( 'display_post_states', [ $this, 'add_display_post_states' ], 10, 2 ); |
| 20 |
} |
| 21 |
|
| 22 |
/** |
| 23 |
* Add a post display state for special WC pages in the page list table. |
| 24 |
* |
| 25 |
* @param array $post_states An array of post display states. |
| 26 |
* @param WP_Post $post The current post object. |
| 27 |
*/ |
| 28 |
public function add_display_post_states( $post_states, $post ) { |
| 29 |
if ( (int) Fns::get_option( 'modules', 'compare', 'page' ) === $post->ID ) { |
| 30 |
$post_states['rtsb_page_for_compare'] = esc_html__( 'Compare Page', 'shopbuilder' ); |
| 31 |
} |
| 32 |
|
| 33 |
return $post_states; |
| 34 |
} |
| 35 |
} |