| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
die( 'You are not allowed to call this page directly.' ); |
| 4 |
} |
| 5 |
|
| 6 |
/** |
| 7 |
* @since 5.0.06 |
| 8 |
*/ |
| 9 |
class FrmElementorController { |
| 10 |
|
| 11 |
/** |
| 12 |
* @return void |
| 13 |
*/ |
| 14 |
public static function register_elementor_hooks() { |
| 15 |
require_once FrmAppHelper::plugin_path() . '/classes/widgets/FrmElementorWidget.php'; |
| 16 |
\Elementor\Plugin::instance()->widgets_manager->register( new \FrmElementorWidget() ); |
| 17 |
|
| 18 |
add_action( 'elementor/editor/after_enqueue_styles', array( self::class, 'enqueue_editor_styles' ) ); |
| 19 |
} |
| 20 |
|
| 21 |
/** |
| 22 |
* Enqueue styles for the Elementor editor to display the Formidable widget icon. |
| 23 |
* |
| 24 |
* @since 6.27 |
| 25 |
* |
| 26 |
* @return void |
| 27 |
*/ |
| 28 |
public static function enqueue_editor_styles() { |
| 29 |
$icon = rawurlencode( FrmAppHelper::svg_logo() ); |
| 30 |
$css = ' |
| 31 |
.elementor-element .icon .frm_logo_icon { |
| 32 |
display: flex; |
| 33 |
align-items: center; |
| 34 |
justify-content: center; |
| 35 |
} |
| 36 |
.elementor-element .icon .frm_logo_icon::before { |
| 37 |
content: ""; |
| 38 |
display: block; |
| 39 |
width: 28px; |
| 40 |
height: 28px; |
| 41 |
background: url("data:image/svg+xml,' . $icon . '") center / contain no-repeat; |
| 42 |
}'; |
| 43 |
|
| 44 |
wp_add_inline_style( 'elementor-editor', $css ); |
| 45 |
} |
| 46 |
|
| 47 |
/** |
| 48 |
* @return void |
| 49 |
*/ |
| 50 |
public static function admin_init() { |
| 51 |
FrmAppController::load_wp_admin_style(); |
| 52 |
FrmFormsController::insert_form_popup(); |
| 53 |
} |
| 54 |
} |
| 55 |
|