<?php
/**
 * Plugin Name: Elementor Addon
 * Description: Simple hello world widgets for Elementor.
 * Version:     1.0.0
 * Author:      Elementor Developer
 * Author URI:  https://developers.elementor.com/
 * Text Domain: elementor-addon
 *
 * Requires Plugins: elementor
 * Elementor tested up to: 3.21.0
 * Elementor Pro tested up to: 3.21.0
 */

function register_hello_world_widget( $widgets_manager ) {
    require_once( __DIR__ . '/widgets/language.php' );

    $widgets_manager->register( new \Elementor_Language() );
}
add_action( 'elementor/widgets/register', 'register_hello_world_widget' );

function enqueue_elementor_addon_styles() {
    if ( did_action( 'elementor/loaded' ) ) {
        wp_enqueue_style(
            'elementor-addon-main-css',
            plugins_url( 'assets/css/main.css', __FILE__ ),
            [],
            '1.0.0'
        );
    }
}
add_action( 'wp_enqueue_scripts', 'enqueue_elementor_addon_styles' );

function enqueue_elementor_addon_scripts() {
    if ( did_action( 'elementor/loaded' ) ) {
        wp_enqueue_script(
            'elementor-addon-main-js',
            plugins_url( 'assets/js/main.js', __FILE__ ),
            [ 'jquery' ],
            '1.0.0',
            true
        );
    }
}
add_action( 'wp_enqueue_scripts', 'enqueue_elementor_addon_scripts' );