| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
die( 'You are not allowed to call this page directly.' ); |
| 4 |
} |
| 5 |
|
| 6 |
/** |
| 7 |
* @since 6.0 |
| 8 |
*/ |
| 9 |
class FrmHtmlHelper { |
| 10 |
|
| 11 |
/** |
| 12 |
* Create a toggle and either echo or return the string. |
| 13 |
* This is intended for use on admin pages only. The CSS is included in frm_admin.css. |
| 14 |
* |
| 15 |
* @since 6.0 |
| 16 |
* |
| 17 |
* @param string $id |
| 18 |
* @param string $name |
| 19 |
* @param array $args { |
| 20 |
* @param bool|null $echo True if you want the toggle to echo. False if you want it to return an HTML string. |
| 21 |
* } |
| 22 |
* |
| 23 |
* @return string|void |
| 24 |
*/ |
| 25 |
public static function toggle( $id, $name, $args ) { |
| 26 |
wp_enqueue_script( 'formidable_settings' ); |
| 27 |
return FrmAppHelper::clip( |
| 28 |
// @phpstan-ignore-next-line |
| 29 |
function() use ( $id, $name, $args ) { |
| 30 |
require FrmAppHelper::plugin_path() . '/classes/views/shared/toggle.php'; |
| 31 |
}, |
| 32 |
isset( $args['echo'] ) ? $args['echo'] : false |
| 33 |
); |
| 34 |
} |
| 35 |
} |
| 36 |
|