芝麻web文件管理V1.00
编辑当前文件:/home/seolotod/critterchoice.com/wp-content/themes/rehub-theme/rehub-elementor/wpsm-particle.php
start_controls_section( 'general_section', [ 'label' => esc_html__( 'General', 'rehub-theme' ), 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, ]); $this->add_control( 'rh_particle_json', array( 'label' => esc_html__( 'Particle json content', 'rehub-theme' ), 'description' => 'Configure it on
Particle site
, download json file and copy content of file to this area', 'type' => \Elementor\Controls_Manager::TEXTAREA, ) ); $this->add_responsive_control( 'rhandwidth', [ 'label' => __('Area width', 'rehub-theme'), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '100', 'unit' => '%', ], 'size_units' => [ '%', 'px'], 'range' => [ '%' => [ 'min' => 1, 'max' => 200, ], 'px' => [ 'min' => 100, 'max' => 2500, ], ], 'selectors' => [ '{{WRAPPER}} .rh-particle-canvas-true' => 'width: {{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'rhandheight', [ 'label' => __('Area height', 'rehub-theme'), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '100', 'unit' => '%', ], 'size_units' => [ '%', 'px'], 'range' => [ '%' => [ 'min' => 1, 'max' => 200, ], 'px' => [ 'min' => 100, 'max' => 2500, ], ], 'selectors' => [ '{{WRAPPER}} .rh-particle-canvas-true' => 'height: {{SIZE}}{{UNIT}};', ], ] ); $this->end_controls_section(); } /* Widget output Rendering */ protected function render() { $settings = $this->get_settings_for_display(); if ( !empty($settings['rh_particle_json'])) { $uniqueid = 'rh_particle_'.mt_rand().'hash'; wp_enqueue_script('rh_elparticle'); $particlejson = sanitize_text_field($settings['rh_particle_json']); $particlecode = 'particlesJS("'.$uniqueid.'", '.$particlejson.', function() {console.log("callback - particles.js config loaded");});'; wp_add_inline_script('rh_elparticle', $particlecode); if ( Plugin::$instance->editor->is_edit_mode() ) { echo '
'; } else{ echo '
'; } } } } Plugin::instance()->widgets_manager->register( new WPSM_Particle_Widget );