$categories ) {
$categories['create']['items']['theme-template'] = [
'title' => esc_html__( 'Add New Theme Template', 'elementor-pro' ),
'icon' => 'plus-circle-o',
'url' => $this->get_admin_templates_url() . '#add_new',
'keywords' => [ 'template', 'theme', 'new', 'create' ],
];
return $categories;
}
/**
* Add New item to admin menu.
*
* @since 3.6.0
* @access private
*/
private function register_admin_menu( MainMenu $menu ) {
$menu->add_submenu( [
'menu_title' => esc_html__( 'Theme Builder', 'elementor-pro' ),
'menu_slug' => Plugin::elementor()->app->get_settings( 'menu_url' ),
'index' => 30,
] );
}
/**
* Add New item to admin menu.
*
* Fired by `admin_menu` action.
*
* @since 3.6.0
* @access private
*/
private function register_admin_menu_legacy( Admin_Menu_Manager $admin_menu ) {
$admin_menu->register( $this->get_admin_templates_url( true ), new Theme_Builder_Menu_Item() );
}
public function print_new_theme_builder_promotion( $views ) {
/** @var Source_Local $source */
$source = Plugin::elementor()->templates_manager->get_source( 'local' );
$current_tab_group = $source->get_current_tab_group();
if ( self::ADMIN_LIBRARY_TAB_GROUP === $current_tab_group ) {
/**
* @var Admin_Notices $admin_notices
*/
$admin_notices = Plugin::elementor()->admin->get_component( 'admin-notices' );
$admin_notices->print_admin_notice( [
'title' => esc_html__( 'Meet the New Theme Builder: More Intuitive and Visual Than Ever', 'elementor-pro' ),
'description' => esc_html__( 'With the new Theme Builder you can visually manage every part of your site intuitively, making the task of designing a complete website that much easier', 'elementor-pro' ),
'button' => [
'text' => esc_html__( 'Try it Now', 'elementor-pro' ),
'class' => 'elementor-button e-accent',
'url' => Plugin::elementor()->app->get_settings( 'menu_url' ),
],
] );
}
return $views;
}
private function get_admin_templates_url( $relative = false ) {
$base_url = Source_Local::ADMIN_MENU_SLUG;
if ( ! $relative ) {
$base_url = admin_url( $base_url );
}
return add_query_arg( 'tabs_group', self::ADMIN_LIBRARY_TAB_GROUP, $base_url );
}
/**
* Get the conflicts between the active templates' conditions and new templates.
*
* @since 3.8.0
*
* @param array $templates
* @return array
*/
public function get_conditions_conflicts( array $templates ) : array {
$conflicts = [];
foreach ( $templates as $template_id => $template ) {
if ( empty( $template['conditions'] ) ) {
continue;
}
foreach ( $template['conditions'] as $condition ) {
$condition = rtrim( implode( '/', $condition ), '/' );
$condition_conflicts = $this->get_conditions_manager()->get_conditions_conflicts_by_location( $condition, $template['location'] );
if ( $condition_conflicts ) {
$conflicts[ $template_id ] = $condition_conflicts;
}
}
}
return $conflicts;
}
/**
* TODO: BC - remove in 3.11.0|4.1.0
* Add conflicts to import result.
*
* @since 3.7.0
*
* @param array $result
* @return array
*/
private function add_conflicts_to_import_result( array $result ) {
$manifest_data = $result['manifest'];
if ( empty( $manifest_data['templates'] ) ) {
return $result;
}
$result['conflicts'] = $this->get_conditions_conflicts( $manifest_data['templates'] );
return $result;
}
/**
* Add attributes to the document wrapper element.
*
* @param array $attributes - The document's wrapper element attributes.
* @param Document $document
*
* @return array
*/
public function add_document_attributes( array $attributes, Document $document ): array {
$attributes['data-elementor-post-type'] = $document->get_post()->post_type;
return $attributes;
}
public function __construct() {
parent::__construct();
require __DIR__ . '/api.php';
$this->add_component( 'theme_support', new Classes\Theme_Support() );
$this->add_component( 'conditions', new Classes\Conditions_Manager() );
$this->add_component( 'templates_types', new Classes\Templates_Types_Manager() );
$this->add_component( 'preview', new Classes\Preview_Manager() );
$this->add_component( 'locations', new Classes\Locations_Manager() );
add_action( 'elementor/controls/register', [ $this, 'register_controls' ] );
// Editor
add_action( 'elementor/editor/init', [ $this, 'on_elementor_editor_init' ] );
add_filter( 'elementor/document/config', [ $this, 'document_config' ], 10, 2 );
add_filter( 'elementor/document/wrapper_attributes', [ $this, 'add_document_attributes' ], 10, 2 );
// Admin
add_action( 'admin_head', [ $this, 'admin_head' ] );
add_filter( 'add_menu_classes', [ $this, 'hide_admin_app_submenu' ], 9 /* Before core submenu fixes */ );
add_action( 'manage_' . Source_Local::CPT . '_posts_custom_column', [ $this, 'admin_columns_content' ], 10, 2 );
add_action( 'elementor/template-library/create_new_dialog_fields', [ $this, 'print_location_field' ] );
add_action( 'elementor/template-library/create_new_dialog_fields', [ $this, 'print_post_type_field' ] );
if ( Plugin::elementor()->experiments->is_feature_active( 'admin_menu_rearrangement' ) ) {
add_action( 'elementor/admin/menu_registered/elementor', function( MainMenu $menu ) {
$this->register_admin_menu( $menu );
} );
} else {
add_action( 'elementor/admin/menu/register', function ( Admin_Menu_Manager $admin_menu ) {
$this->register_admin_menu_legacy( $admin_menu );
}, static::ADMIN_MENU_PRIORITY /* After "Popups" */ );
// TODO: BC - Remove after `Admin_Menu_Manager` will be the standard.
add_action( 'admin_menu', function () {
if ( did_action( 'elementor/admin/menu/register' ) ) {
return;
}
add_submenu_page(
Source_Local::ADMIN_MENU_SLUG,
'',
esc_html__( 'Theme Builder', 'elementor-pro' ),
'publish_posts',
$this->get_admin_templates_url( true )
);
}, 22 /* After core promotion menu */ );
}
add_filter( 'elementor/template-library/create_new_dialog_types', [ $this, 'create_new_dialog_types' ] );
add_filter( 'views_edit-' . Source_Local::CPT, [ $this, 'print_new_theme_builder_promotion' ], 9 );
// Moved into the IE module \ElementorPro\Core\App\Modules\ImportExport\Module::add_actions
// TODO: remove in 3.10.0
add_filter( 'elementor/import/stage_1/result', function ( array $result ) {
return $this->add_conflicts_to_import_result( $result );
});
// Common
add_filter( 'elementor/finder/categories', [ $this, 'add_finder_items' ] );
}
}
Fatal error: Uncaught Error: Class 'ElementorPro\Modules\ThemeBuilder\Module' not found in /var/www/html/piauinanet.com/web/wp-content/plugins/elementor-pro/core/app/modules/site-editor/module.php:205
Stack trace:
#0 /var/www/html/piauinanet.com/web/wp-content/plugins/elementor-pro/core/app/app.php(87): ElementorPro\Core\App\Modules\SiteEditor\Module->__construct()
#1 /var/www/html/piauinanet.com/web/wp-content/plugins/elementor-pro/plugin.php(477): ElementorPro\Core\App\App->__construct()
#2 /var/www/html/piauinanet.com/web/wp-content/plugins/elementor-pro/plugin.php(139): ElementorPro\Plugin->__construct()
#3 /var/www/html/piauinanet.com/web/wp-content/plugins/elementor-pro/plugin.php(517): ElementorPro\Plugin::instance()
#4 /var/www/html/piauinanet.com/web/wp-content/plugins/elementor-pro/elementor-pro.php(95): require('/var/www/html/p...')
#5 /var/www/html/piauinanet.com/web/wp-includes/class-wp-hook.php(324): elementor_pro_load_plugin('')
#6 /var/www/html/piauinanet.com/web/wp-includes/class-wp-hook.php(348): WP_Hook in /var/www/html/piauinanet.com/web/wp-content/plugins/elementor-pro/core/app/modules/site-editor/module.php on line 205