MP_Calculator_Elementor::init()

Initialize the plugin.


Description Description

Load the plugin only after Elementor (and other plugins) are loaded. Checks for basic plugin requirements, if one check fail don’t continue, if all check have passed load the files required to run the plugin.

Fired by plugins_loaded action hook.


Top ↑

Source Source

File: mortgage-platform/Inc/Calculators/MortgageCalculator/Extensions/MP_Calculator_Elementor.php

	public function init() {

		// Check if Elementor installed and activated
		if ( ! did_action( 'elementor/loaded' ) ) {
			add_action( 'admin_notices', array( $this, 'admin_notice_missing_main_plugin' ) );
			return;
		}

		// Check for required Elementor version
		if ( ! version_compare( ELEMENTOR_VERSION, self::MINIMUM_ELEMENTOR_VERSION, '>=' ) ) {
			add_action( 'admin_notices', array( $this, 'admin_notice_minimum_elementor_version' ) );
			return;
		}

		// Check for required PHP version
		if ( version_compare( PHP_VERSION, self::MINIMUM_PHP_VERSION, '<' ) ) {
			add_action( 'admin_notices', array( $this, 'admin_notice_minimum_php_version' ) );
			return;
		}

		// Add Plugin actions
		add_action( 'elementor/widgets/widgets_registered', array( $this, 'init_widgets' ) );
		add_action( 'elementor/controls/controls_registered', array( $this, 'init_controls' ) );
	}

Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0 Introduced.