storefront instead of constructor injection. */ /** * Widget machine name. * * @return string */ public function get_name() { return 'aisthetix_tryon'; } /** * Widget human title. * * @return string */ public function get_title() { return esc_html__( 'aisthetix Try-On', 'aisthetix-virtual-try-on' ); } /** * Widget icon. * * @return string */ public function get_icon() { return 'eicon-image-rollover'; } /** * Widget categories. * * @return array */ public function get_categories() { return array( 'woocommerce-elements', 'general' ); } /** * Search keywords. * * @return array */ public function get_keywords() { return array( 'aisthetix', 'try-on', 'tryon', 'virtual', 'fitting', 'woocommerce' ); } /** * Register widget controls. * * @return void */ protected function register_controls() { $this->start_controls_section( 'content_section', array( 'label' => esc_html__( 'Try-On', 'aisthetix-virtual-try-on' ), 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, ) ); $this->add_control( 'label', array( 'label' => esc_html__( 'Button label', 'aisthetix-virtual-try-on' ), 'type' => \Elementor\Controls_Manager::TEXT, 'default' => '', 'placeholder' => esc_html__( 'Try it on', 'aisthetix-virtual-try-on' ), ) ); $this->end_controls_section(); } /** * Render the widget on the front end. * * @return void */ protected function render() { $settings = $this->get_settings_for_display(); $label = isset( $settings['label'] ) ? sanitize_text_field( $settings['label'] ) : ''; // Resolve the render delegate lazily (see the note on the missing constructor). $storefront = Plugin::instance()->storefront; $html = $storefront instanceof Storefront ? $storefront->render_button( array( 'label' => $label, 'surface' => 'elementor' ) ) : ''; if ( '' === $html && \Elementor\Plugin::$instance->editor->is_edit_mode() ) { printf( '