| 1 |
<?php |
| 2 |
/** |
| 3 |
* WPDataTables integration. |
| 4 |
* |
| 5 |
* Registers the wpDataTables shortcode as a container so that `[copy]` |
| 6 |
* inside table cells trigger script enqueue and work with cached/dynamic table output. |
| 7 |
* |
| 8 |
* @package CTC |
| 9 |
* @since 5.5.1 |
| 10 |
*/ |
| 11 |
|
| 12 |
namespace CTC\ThirdParty; |
| 13 |
|
| 14 |
if ( ! defined( 'ABSPATH' ) ) { |
| 15 |
exit; |
| 16 |
} |
| 17 |
|
| 18 |
/** |
| 19 |
* Class WPDataTables |
| 20 |
*/ |
| 21 |
class WPDataTables { |
| 22 |
|
| 23 |
/** |
| 24 |
* Constructor. |
| 25 |
*/ |
| 26 |
public function __construct() { |
| 27 |
add_filter( 'ctc/shortcode/container_shortcodes', [ $this, 'add_container_shortcodes' ], 10, 1 ); |
| 28 |
} |
| 29 |
|
| 30 |
/** |
| 31 |
* Add wpDataTables shortcode to the list of container shortcodes. |
| 32 |
* |
| 33 |
* @param string[] $container_shortcodes List of shortcode names that may output [copy] in their content. |
| 34 |
* @return string[] Modified list. |
| 35 |
*/ |
| 36 |
public function add_container_shortcodes( $container_shortcodes ) { |
| 37 |
$container_shortcodes[] = 'wpdatatable'; |
| 38 |
return $container_shortcodes; |
| 39 |
} |
| 40 |
} |
| 41 |
|