Skip to content

Commit

Permalink
Use testimonial URLs to link location and optionally link names and i…
Browse files Browse the repository at this point in the history
…mages.

Removed unused new_window checkbox.
  • Loading branch information
braamgenis committed Dec 4, 2015
1 parent 3a75e6f commit 1d3b02c
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 10 deletions.
18 changes: 11 additions & 7 deletions widgets/testimonial/testimonial.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ function __construct() {
'description' => __('The author of the testimonial', 'so-widgets-bundle'),
),

'link_name' => array(
'type' => 'checkbox',
'label' => __('Link name', 'so-widgets-bundle'),
),

'location' => array(
'type' => 'text',
'label' => __('Location', 'so-widgets-bundle'),
Expand All @@ -51,6 +56,11 @@ function __construct() {
'label' => __('Image', 'so-widgets-bundle'),
),

'link_image' => array(
'type' => 'checkbox',
'label' => __('Link image', 'so-widgets-bundle'),
),

'text' => array(
'type' => 'tinymce',
'label' => __('Text', 'so-widgets-bundle'),
Expand Down Expand Up @@ -133,12 +143,6 @@ function __construct() {

)
),

'new_window' => array(
'type' => 'checkbox',
'label' => __('Open links in new window', 'so-widgets-bundle'),
'description' => __('Should testimonial URLs open in a new window.', 'so-widgets-bundle'),
),
)
),

Expand Down Expand Up @@ -329,4 +333,4 @@ function testimonial_wrapper_class($design){

}

siteorigin_widget_register( 'sow-testimonials', __FILE__, 'SiteOrigin_Widgets_Testimonials_Widget' );
siteorigin_widget_register( 'sow-testimonials', __FILE__, 'SiteOrigin_Widgets_Testimonials_Widget' );
35 changes: 32 additions & 3 deletions widgets/testimonial/tpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@
<?php $this->caret_svg() ?>
<div class="sow-testimonials">
<?php foreach( $testimonials as $testimonial ) : ?>
<?php
$url = $testimonial['url'];
$new_window = $testimonial['new_window'];
$location = $testimonial['location'];
$link_location = ! empty( $url );
$link_name = ! empty( $testimonial['link_name'] ) && ! empty( $url );
$link_image = ! empty( $testimonial['link_image'] ) && ! empty( $url );
?>
<div class="sow-testimonial-wrapper <?php echo $this->testimonial_wrapper_class($design) ?>">
<div class="sow-testimonial">
<?php if( strpos($design['layout'], '_above') !== false ) : ?>
Expand All @@ -18,11 +26,32 @@

<div class="sow-testimonial-user">
<div class="sow-image-wrapper">
<?php if( $link_image ) : ?>
<a href="<?php echo sow_esc_url( $url ) ?>" <?php if( ! empty( $new_window ) ) { echo 'target="_blank"'; } ?>>
<?php endif; ?>
<?php echo $this->testimonial_user_image($testimonial, $design) ?>
<?php if( $link_image ) : ?>
</a>
<?php endif; ?>
</div>

<div class="sow-text">
<strong><?php echo esc_html( $testimonial['name'] ) ?></strong>
<a><?php echo esc_html( $testimonial['location'] ) ?></a>
<?php if( $link_name ) : ?>
<a href="<?php echo sow_esc_url( $url ) ?>" <?php if( ! empty( $new_window ) ) { echo 'target="_blank"'; } ?>>
<?php endif; ?>
<strong><?php echo esc_html( $testimonial['name'] ) ?></strong>
<?php if( $link_name ) : ?>
</a>
<?php endif; ?>
<?php if( $link_location ) : ?>
<a href="<?php echo sow_esc_url( $url ) ?>" <?php if( ! empty( $new_window ) ) { echo 'target="_blank"'; } ?>>
<?php endif; ?>
<?php if( ! empty( $location ) ) : ?>
<span><?php echo esc_html( $location ) ?></span>
<?php endif; ?>
<?php if( $link_location ) : ?>
</a>
<?php endif; ?>
</div>

<?php // $this->testimonial_pointer($design) ?>
Expand All @@ -36,4 +65,4 @@
</div>
</div>
<?php endforeach; ?>
</div>
</div>

0 comments on commit 1d3b02c

Please sign in to comment.