startControlsSection( 'section_anchor', [ 'label' => __('Anchor'), ] ); $this->addControl( 'anchor', [ 'label' => __('The ID of Menu Anchor.'), 'type' => ControlsManager::TEXT, 'placeholder' => __('For Example: About'), 'description' => __('This ID will be the CSS ID you will have to use in your own page, Without #.'), 'label_block' => true, ] ); $this->addControl( 'anchor_note', [ 'type' => ControlsManager::RAW_HTML, 'raw' => sprintf(__('Note: The ID link ONLY accepts these chars: %s'), '`A-Z, a-z, 0-9, _ , -`'), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning', ] ); $this->endControlsSection(); } /** * Render menu anchor widget output on the frontend. * * Written in PHP and used to generate the final HTML. * * @since 1.0.0 */ protected function render() { $anchor = $this->getSettingsForDisplay('anchor'); if (!empty($anchor)) { $this->addRenderAttribute('inner', 'id', sanitize_html_class($anchor)); } $this->addRenderAttribute('inner', 'class', 'elementor-menu-anchor'); ?>