Hooks.php
30 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WCML\Reviews\Backend; |
| 4 | |
| 5 | use SitePress; |
| 6 | |
| 7 | class Hooks implements \IWPML_Backend_Action, \IWPML_DIC_Action { |
| 8 | |
| 9 | const AFTER_SITEPRESS_JS_LOAD = 3; |
| 10 | |
| 11 | private $sitepress; |
| 12 | |
| 13 | public function __construct( SitePress $sitepress ) { |
| 14 | $this->sitepress = $sitepress; |
| 15 | } |
| 16 | |
| 17 | public function add_hooks() { |
| 18 | add_action( 'admin_enqueue_scripts', [ $this, 'disableLanguageQuickLinks' ], self::AFTER_SITEPRESS_JS_LOAD ); |
| 19 | } |
| 20 | |
| 21 | public function disableLanguageQuickLinks() { |
| 22 | $getData = wpml_collect( $_GET ); |
| 23 | |
| 24 | if ( 'product' === $getData->get( 'post_type' ) && 'product-reviews' === $getData->get( 'page' ) ) { |
| 25 | remove_action( 'admin_enqueue_scripts', [ $this->sitepress, 'language_filter' ] ); |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | } |
| 30 |