rray_key_exists( 'initial_document', $config ) ) { return $config; } if ( ! array_key_exists( 'panel', $config['initial_document'] ) ) { return $config; } if ( ! array_key_exists( 'elements_categories', $config['initial_document']['panel'] ) ) { return $config; } if ( ! array_key_exists( 'pro-elements', $config['initial_document']['panel']['elements_categories'] ) ) { return $config; } if ( ! array_key_exists( 'obfx-elementor-widgets', $config['initial_document']['panel']['elements_categories'] ) ) { return $config; } $elements_categories = $config['initial_document']['panel']['elements_categories']; $obfx_cat = array( 'obfx-elementor-widgets' => $elements_categories['obfx-elementor-widgets'] ); unset( $elements_categories['obfx-elementor-widgets'] ); $config['initial_document']['panel']['elements_categories'] = $this->insert_before_element( $elements_categories, 'pro-elements', $obfx_cat ); $elements_categories = $config['initial_document']['panel']['elements_categories']; if ( $this->should_add_placeholders() && array_key_exists( 'obfx-elementor-widgets-pro', $elements_categories ) ) { $placeholders_cat = array( 'obfx-elementor-widgets-pro' => $elements_categories['obfx-elementor-widgets-pro'] ); unset( $elements_categories['obfx-elementor-widgets-pro'] ); $config['initial_document']['panel']['elements_categories'] = $this->insert_before_element( $elements_categories, 'pro-elements', $placeholders_cat ); } return $config; } /** * Insert element after specific key. * * @param array $array Destination array. * @param string $key Where to insert. * @param array $el What to insert. * @return array */ private function insert_before_element( $array, $key, $el ) { $keys = array_keys( $array ); $index = array_search( $key, $keys ); $pos = false === $index ? count( $array ) : $index; return array_merge( array_slice( $array, 0, $pos ), $el, array_slice( $array, $pos ) ); } /** * Load font awesome scripts in admin. */ public function load_fa_styles() { wp_enqueue_style( 'font-awesome-5-all', ELEMENTOR_ASSETS_URL . '/lib/font-awesome/css/all.min.css', array(), '2.10.9' ); } /** * Load required scripts in admin. */ public function enqueue_editor_scripts() { wp_add_inline_script( 'elementor-editor', ' $e.routes.on(\'run\', function(){ setTimeout( function() { jQuery( \'#elementor-panel-category-obfx-elementor-widgets-pro .elementor-element-wrapper\' ).on( \'click mousedown drop\', function(e) { e.preventDefault(); }); jQuery( \'#elementor-panel-category-obfx-elementor-widgets-pro .elementor-element-wrapper\' ).on( \'click drop\', function(e) { window.open( \'' . tsdk_utmify( 'https://themeisle.com/themes/neve/upgrade/', 'elementorwidgetsdrag', 'orbitfox' ) . '\',\'_blank\'); }); }, 1000 ); }); ' ); } /** * Load required styles in admin. */ public function enqueue_editor_styles() { wp_add_inline_style( 'elementor-editor', ' #elementor-panel-category-obfx-elementor-widgets-pro .elementor-element-wrapper { position:relative; } #elementor-panel-category-obfx-elementor-widgets-pro .elementor-element { cursor: pointer; } #elementor-panel-category-obfx-elementor-widgets-pro .elementor-element-wrapper:before{ content: \'\e96f\'; position: absolute; top: 5px; right: 5px; color: #64666A; font-family: eicons; z-index: 1; } ' ); } /** * Method that returns an array of scripts and styles to be loaded * for the front end part. * * @since 1.0.0 * @access public * @return array */ public function public_enqueue() { return array(); } /** * Method that returns an array of scripts and styles to be loaded * for the admin part. * * @since 1.0.0 * @access public * @return array */ public function admin_enqueue() { return array(); } /** * Method to define the options fields for the module * * @since 1.0.0 * @access public * @return array */ public function options() { $options = array(); return $options; } /** * If the content-forms library is available we should make the forms available for elementor */ public function load_content_forms() { if ( ! class_exists( '\ThemeIsle\ContentForms\Form_Manager' ) ) { return false; } $content_forms = new Form_Manager(); $content_forms->instance(); return true; } /** * Call the ElementorExtraWidgets Library which will register its own actions. */ public function load_elementor_extra_widgets() { if ( class_exists( '\ThemeIsle\ElementorExtraWidgets' ) ) { \ThemeIsle\ElementorExtraWidgets::instance(); } } }