first commit
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
namespace ElementorPro\Modules\MegaMenu;
|
||||
|
||||
use Elementor\Core\Experiments\Manager;
|
||||
use ElementorPro\Base\Module_Base;
|
||||
use ElementorPro\Plugin;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
class Module extends Module_Base {
|
||||
|
||||
const EXPERIMENT_NAME = 'mega-menu';
|
||||
|
||||
public function get_widgets() {
|
||||
return [
|
||||
'Mega_Menu',
|
||||
];
|
||||
}
|
||||
|
||||
public function get_name() {
|
||||
return 'mega-menu';
|
||||
}
|
||||
|
||||
public static function is_active() {
|
||||
return Plugin::elementor()->experiments->is_feature_active( \Elementor\Modules\NestedElements\Module::EXPERIMENT_NAME );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add to the experiments
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function get_experimental_data() {
|
||||
$experiment_data = [
|
||||
'name' => static::EXPERIMENT_NAME,
|
||||
'title' => esc_html__( 'Menu', 'elementor-pro' ),
|
||||
'description' => sprintf(
|
||||
esc_html__( 'Create beautiful menus and mega menus with new nested capabilities. Mega menus are ideal for websites with complex navigation structures and unique designs. %1$sLearn More%2$s', 'elementor-pro' ),
|
||||
'<a href="https://go.elementor.com/wp-dash-mega-menu/" target="_blank">',
|
||||
'</a>'
|
||||
),
|
||||
'hidden' => false,
|
||||
'release_status' => Manager::RELEASE_STATUS_BETA,
|
||||
'default' => Manager::STATE_INACTIVE,
|
||||
'dependencies' => [
|
||||
'container',
|
||||
'nested-elements',
|
||||
],
|
||||
];
|
||||
|
||||
if ( version_compare( ELEMENTOR_VERSION, '3.11.0', '<' ) ) {
|
||||
$experiment_data['mutable'] = false;
|
||||
$experiment_data['dependencies'] = [];
|
||||
}
|
||||
return $experiment_data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
namespace ElementorPro\Modules\MegaMenu\Traits;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
trait Url_Helper_Trait {
|
||||
|
||||
public function parse_url( $url ) {
|
||||
$link_array = wp_parse_url( $url );
|
||||
|
||||
return [
|
||||
'host' => ! empty( $link_array['host'] ) ? str_replace( 'www.', '', $link_array['host'] ) : '',
|
||||
'path' => ! empty( $link_array['path'] ) ? trim( $link_array['path'], '/' ) : '',
|
||||
'query' => ! empty( $link_array['query'] ) ? $link_array['query'] : '',
|
||||
];
|
||||
}
|
||||
|
||||
public function get_permalink_for_current_page() {
|
||||
if ( ! is_front_page() && is_home() ) {
|
||||
return get_post_type_archive_link( 'post' );
|
||||
} elseif ( is_front_page() && is_home() ) {
|
||||
return home_url();
|
||||
} elseif ( is_year() ) {
|
||||
return get_year_link( get_query_var( 'year' ) );
|
||||
} elseif ( is_month() ) {
|
||||
return get_month_link( get_query_var( 'year' ), get_query_var( 'monthnum' ) );
|
||||
} elseif ( is_day() ) {
|
||||
return get_day_link( get_query_var( 'year' ), get_query_var( 'monthnum' ), get_query_var( 'day' ) );
|
||||
} elseif ( is_category() || is_tag() || is_tax() ) {
|
||||
$queried_object = get_queried_object();
|
||||
return get_term_link( $queried_object->term_id, $queried_object->taxonomy );
|
||||
} elseif ( is_author() ) {
|
||||
return get_author_posts_url( get_the_author_meta( 'ID' ) );
|
||||
} elseif ( is_search() ) {
|
||||
return get_search_link();
|
||||
} elseif ( is_archive() ) {
|
||||
return get_post_type_archive_link( get_post_type() );
|
||||
}
|
||||
|
||||
return ! ( empty( get_the_permalink() ) ) ? get_the_permalink() : '';
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user