polylang.php
43 lines
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | namespace JFB_Compatibility\Polylang; |
| 5 | |
| 6 | // If this file is called directly, abort. |
| 7 | if ( ! defined( 'WPINC' ) ) { |
| 8 | die(); |
| 9 | } |
| 10 | |
| 11 | use JFB_Components\Module\Base_Module_It; |
| 12 | |
| 13 | class Polylang implements Base_Module_It { |
| 14 | |
| 15 | public function rep_item_id() { |
| 16 | return 'polylang'; |
| 17 | } |
| 18 | |
| 19 | public function condition(): bool { |
| 20 | return function_exists( 'PLL' ); |
| 21 | } |
| 22 | |
| 23 | public function init_hooks() { |
| 24 | add_filter( |
| 25 | 'jet-form-builder/render-choice/query-options/posts', |
| 26 | array( $this, 'remove_suppress_filters' ) |
| 27 | ); |
| 28 | } |
| 29 | |
| 30 | public function remove_hooks() { |
| 31 | remove_filter( |
| 32 | 'jet-form-builder/render-choice/query-options/posts', |
| 33 | array( $this, 'remove_suppress_filters' ) |
| 34 | ); |
| 35 | } |
| 36 | |
| 37 | public function remove_suppress_filters( array $args ): array { |
| 38 | $args['suppress_filters'] = false; |
| 39 | |
| 40 | return $args; |
| 41 | } |
| 42 | } |
| 43 |