]
);
+ // Additional link control
+ // Ideally this would be a widget of its own but due to the text-block scaling
+ // and the need for absolute positioning it, we can't put another widget under
+ // the text-block without some big changes. This is the compromise...
+
+ $this->add_control(
+ 'extra_link_text',
+ [
+ 'label' => __('Extra link text', 'physioassist'),
+ 'type' => Controls_Manager::TEXT,
+ 'default' => ''
+ ]
+ );
+
+ $this->add_control(
+ 'extra_link_URL',
+ [
+ 'label' => __('Extra link URL', 'physioassist'),
+ 'type' => Controls_Manager::URL,
+ 'default' => [
+ 'url' => '',
+ 'is_external' => false,
+ ],
+ 'show_external' => true
+ ]
+ );
+
$this->end_controls_section();
$cta_text = $this->get_settings('cta_text');
$cta_link = $this->get_settings('cta_link');
$cta_tag = 'a'; // Default tag type
+ $extra_link_text = $this->get_settings('extra_link_text');
+ $extra_link_URL = $this->get_settings('extra_link_URL');
if ( ! empty( $cta_link['url'] ) ) {
}
}
+ if ( ! empty( $extra_link_URL['url'] ) ) {
+
+ $this->add_render_attribute( 'extra_link_text', 'href', $extra_link_URL['url'] );
+
+ if ( $extra_link_URL['is_external'] ) {
+ $this->add_render_attribute( 'extra_link_text', 'target', '_blank' );
+ }
+
+ if ( $extra_link_URL['nofollow'] ) {
+ $this->add_render_attribute( 'extra_link_text', 'rel', 'nofollow' );
+ }
+ }
+
// Inline Editing settings
$this->add_inline_editing_attributes('subtitle', 'none');
$this->add_inline_editing_attributes('title', 'none');
$this->add_inline_editing_attributes('body', 'advanced');
$this->add_inline_editing_attributes('cta_text', 'none');
+ $this->add_inline_editing_attributes('extra_link_text', 'none');
// CSS Classes for elements
$this->add_render_attribute('subtitle', 'class', ['text-block-subtitle']);
$this->add_render_attribute('title', 'class', ['text-block-title']);
$this->add_render_attribute('body', 'class', ['text-block-body']);
$this->add_render_attribute('cta_text', 'class', ['text-block-cta arrow-link']);
+ $this->add_render_attribute('extra_link_text', 'class', ['text-block-extra-link arrow-link']);
// Rendered content
echo '<div class="text-block">';
if (!empty($cta_text)) {
echo "<$cta_tag {$this->get_render_attribute_string('cta_text')}>". \BladeSvgSage\svg_image('arrow')->toHtml() ."$cta_text</$cta_tag>";
}
+ if (!empty($extra_link_text)) {
+ echo "<a {$this->get_render_attribute_string('extra_link_text')}>". \BladeSvgSage\svg_image('arrow')->toHtml() ."$extra_link_text</a>";
+ }
echo '</div>';
}
view.addRenderAttribute( 'title', 'class', ['text-block-title']);
view.addRenderAttribute( 'body', 'class', ['text-block-body']);
view.addRenderAttribute( 'cta_text', 'class', ['text-block-cta arrow-link']);
+ view.addRenderAttribute( 'cta_text', 'href', ['#']);
+ view.addRenderAttribute( 'extra_link_text', 'class', ['text-block-extra-link arrow-link']);
+ view.addRenderAttribute( 'extra_link_text', 'href', ['#']);
+
view.addInlineEditingAttributes( 'subtitle', 'none' );
view.addInlineEditingAttributes( 'title', 'none' );
view.addInlineEditingAttributes( 'body', 'advanced' );
view.addInlineEditingAttributes( 'cta_text', 'none' );
+ view.addInlineEditingAttributes( 'extra_link_text', 'none' );
#>
<div class="text-block">
<a {{{ view.getRenderAttributeString( 'cta_text' ) }}}><?= \BladeSvgSage\svg_image('arrow')->toHtml() ?>{{{ settings.cta_text }}}</a>
<# } #>
+ <# if ('' !== settings.extra_link_text) { #>
+ <a {{{ view.getRenderAttributeString( 'extra_link_text' ) }}}><?= \BladeSvgSage\svg_image('arrow')->toHtml() ?>{{{ settings.extra_link_text }}}</a>
+ <# } #>
+
</div>
<?php
}