get_settings_for_display(); return $behavior; } protected function register_controls() { $this->start_controls_section( 'general_section', [ 'label' => __( 'General', 'aihub-core' ), ] ); $this->add_control( 'spline_source', [ 'label' => esc_html__( 'Source', 'aihub-core' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'external' => esc_html__( 'External URL', 'aihub-core' ), ], 'default' => 'external', ] ); $this->add_control( 'spline_url', [ 'label' => esc_html__( 'Spline url', 'aihub-core' ), 'placeholder' => esc_html__( 'Add the url pointing to the .splinecode file', 'aihub-core' ), 'type' => Controls_Manager::URL, 'options' => false, 'dynamic' => [ 'active' => true, ], 'condition' => [ 'spline_source' => 'external', ], ] ); $this->add_control( 'onload_script', [ 'label' => esc_html__( 'OnLoad Script', 'aihub-core' ), 'description' => __( 'Add a script to run after the spline has loaded. You have access to scene variable for the loaded scene in this code block.', 'aihub-core' ), 'default' => 'console.log(scene);', 'type' => Controls_Manager::CODE, 'language' => 'javascript', 'rows' => 20, ] ); $this->end_controls_section(); } protected function render() { $settings = $this->get_settings_for_display(); extract( $settings ); $id = 'lqd-spline-' . $this->get_id(); if ( $spline_source === 'internal' ){ $spline_src = isset( $settings['spline_file']['url'] ) ? esc_url( $settings['spline_file']['url'] ) : ''; } else { $spline_src = isset( $settings['spline_url']['url'] ) ? esc_url( $settings['spline_url']['url'] ) : ''; } if ( empty( $spline_src ) ){ return; } ?> widgets_manager->register( new LQD_Spline() );