startControlsSection( 'section_title', [ 'label' => __('Title'), ] ); $this->addControl( 'title', [ 'label' => __('Title'), 'type' => ControlsManager::TEXTAREA, 'dynamic' => [ 'active' => true, ], 'placeholder' => __('Enter your title'), 'default' => __('Add Your Heading Text Here'), ] ); $this->addControl( 'link', [ 'label' => __('Link'), 'type' => ControlsManager::URL, 'dynamic' => [ 'active' => true, ], 'default' => [ 'url' => '', ], 'separator' => 'before', ] ); $this->addControl( 'size', [ 'label' => __('Size'), 'type' => ControlsManager::SELECT, 'default' => 'default', 'options' => [ 'default' => __('Default'), 'small' => __('Small'), 'medium' => __('Medium'), 'large' => __('Large'), 'xl' => __('XL'), 'xxl' => __('XXL'), ], ] ); $this->addControl( 'header_size', [ 'label' => __('HTML Tag'), 'type' => ControlsManager::SELECT, 'options' => [ 'h1' => 'H1', 'h2' => 'H2', 'h3' => 'H3', 'h4' => 'H4', 'h5' => 'H5', 'h6' => 'H6', 'div' => 'div', 'span' => 'span', 'p' => 'p', ], 'default' => 'h2', ] ); $this->addResponsiveControl( 'align', [ 'label' => __('Alignment'), 'type' => ControlsManager::CHOOSE, 'options' => [ 'left' => [ 'title' => __('Left'), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __('Center'), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __('Right'), 'icon' => 'fa fa-align-right', ], 'justify' => [ 'title' => __('Justified'), 'icon' => 'fa fa-align-justify', ], ], 'default' => '', 'selectors' => [ '{{WRAPPER}}' => 'text-align: {{VALUE}};', ], ] ); $this->addControl( 'view', [ 'label' => __('View'), 'type' => ControlsManager::HIDDEN, 'default' => 'traditional', ] ); $this->endControlsSection(); $this->startControlsSection( 'section_title_style', [ 'label' => __('Title'), 'tab' => ControlsManager::TAB_STYLE, ] ); $this->addControl( 'title_color', [ 'label' => __('Text Color'), 'type' => ControlsManager::COLOR, 'scheme' => [ 'type' => SchemeColor::getType(), 'value' => SchemeColor::COLOR_1, ], 'selectors' => [ // Stronger selector to avoid section style from overwriting '{{WRAPPER}}.elementor-widget-heading .elementor-heading-title' => 'color: {{VALUE}};', ], ] ); $this->addGroupControl( GroupControlTypography::getType(), [ 'name' => 'typography', 'scheme' => SchemeTypography::TYPOGRAPHY_1, 'selector' => '{{WRAPPER}} .elementor-heading-title', ] ); $this->addGroupControl( GroupControlTextStroke::getType(), [ 'name' => 'text_stroke', 'selector' => '{{WRAPPER}} .elementor-heading-title', ] ); $this->addGroupControl( GroupControlTextShadow::getType(), [ 'name' => 'text_shadow', 'selector' => '{{WRAPPER}} .elementor-heading-title', ] ); $this->addControl( 'blend_mode', [ 'label' => __('Blend Mode'), 'type' => ControlsManager::SELECT, 'options' => [ '' => __('Normal'), 'multiply' => 'Multiply', 'screen' => 'Screen', 'overlay' => 'Overlay', 'darken' => 'Darken', 'lighten' => 'Lighten', 'color-dodge' => 'Color Dodge', 'saturation' => 'Saturation', 'color' => 'Color', 'difference' => 'Difference', 'exclusion' => 'Exclusion', 'hue' => 'Hue', 'luminosity' => 'Luminosity', ], 'selectors' => [ '{{WRAPPER}} .elementor-heading-title' => 'mix-blend-mode: {{VALUE}}', ], 'separator' => 'none', ] ); $this->endControlsSection(); } /** * Render heading widget output on the frontend. * * Written in PHP and used to generate the final HTML. * * @since 1.0.0 * @access protected */ protected function render() { $settings = $this->getSettingsForDisplay(); if (empty($settings['title'])) { return; } $this->addRenderAttribute('title', 'class', 'elementor-heading-title'); if (!empty($settings['size'])) { $this->addRenderAttribute('title', 'class', 'elementor-size-' . $settings['size']); } $this->addInlineEditingAttributes('title'); $title = $settings['title']; if (!empty($settings['link']['url'])) { $this->addRenderAttribute('url', 'href', $settings['link']['url']); if ($settings['link']['is_external']) { $this->addRenderAttribute('url', 'target', '_blank'); } if (!empty($settings['link']['nofollow'])) { $this->addRenderAttribute('url', 'rel', 'nofollow'); } $title = sprintf('%2$s', $this->getRenderAttributeString('url'), $title); } printf( '<%1$s %2$s>%3$s', $settings['header_size'], $this->getRenderAttributeString('title'), $title ); } /** * Render heading widget output in the editor. * * Written as a Backbone JavaScript template and used to generate the live preview. * * @since 1.0.0 * @access protected */ protected function _contentTemplate() { ?> <# var title = settings.title, header_size = settings.header_size; if ( '' !== settings.link.url ) { title = '' + title + ''; } view.addRenderAttribute( 'title', 'class', [ 'elementor-heading-title', 'elementor-size-' + settings.size ] ); view.addInlineEditingAttributes( 'title' ); #> <{{ header_size }} {{{ view.getRenderAttributeString( 'title' ) }}}>{{{ title }}}