| 1 |
<p> |
| 2 |
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'jetpack' ); ?> |
| 3 |
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" |
| 4 |
type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" /> |
| 5 |
</label> |
| 6 |
</p> |
| 7 |
|
| 8 |
<p> |
| 9 |
<label> |
| 10 |
<?php esc_html_e( 'Images:', 'jetpack' ); ?> |
| 11 |
</label> |
| 12 |
</p> |
| 13 |
|
| 14 |
<div class="gallery-widget-thumbs-wrapper"> |
| 15 |
<div class="gallery-widget-thumbs"> |
| 16 |
<?php |
| 17 |
|
| 18 |
// Add the thumbnails to the widget box |
| 19 |
$attachments = $this->get_attachments( $instance ); |
| 20 |
|
| 21 |
foreach( $attachments as $attachment ){ |
| 22 |
$url = add_query_arg( array( |
| 23 |
'w' => self::THUMB_SIZE, |
| 24 |
'h' => self::THUMB_SIZE, |
| 25 |
'crop' => 'true' |
| 26 |
), wp_get_attachment_url( $attachment->ID ) ); |
| 27 |
|
| 28 |
?> |
| 29 |
|
| 30 |
<img src="<?php echo esc_url( $url ); ?>" title="<?php echo esc_attr( $attachment->post_title ); ?>" alt="<?php echo esc_attr( $attachment->post_title ); ?>" |
| 31 |
width="<?php echo self::THUMB_SIZE; ?>" height="<?php echo self::THUMB_SIZE; ?>" class="thumb" /> |
| 32 |
<?php } ?> |
| 33 |
</div> |
| 34 |
|
| 35 |
<div style="clear: both;"></div> |
| 36 |
</div> |
| 37 |
|
| 38 |
<p> |
| 39 |
<a class="button gallery-widget-choose-images"><span class="wp-media-buttons-icon"></span> <?php esc_html_e( 'Choose Images', 'jetpack' ); ?></a> |
| 40 |
</p> |
| 41 |
|
| 42 |
<p class="gallery-widget-link-wrapper"> |
| 43 |
<label for="<?php echo $this->get_field_id( 'link' ); ?>"><?php esc_html_e( 'Link To:', 'jetpack' ); ?></label> |
| 44 |
<select name="<?php echo $this->get_field_name( 'link' ); ?>" id="<?php echo $this->get_field_id( 'link' ); ?>" class="widefat"> |
| 45 |
<?php foreach ( $allowed_values['link'] as $key => $label ) { |
| 46 |
$selected = ''; |
| 47 |
|
| 48 |
if ( $instance['link'] == $key ) { |
| 49 |
$selected = "selected='selected' "; |
| 50 |
} ?> |
| 51 |
|
| 52 |
<option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo esc_html( $label, 'jetpack' ); ?></option> |
| 53 |
<?php } ?> |
| 54 |
</select> |
| 55 |
</p> |
| 56 |
|
| 57 |
<p> |
| 58 |
<label for="<?php echo $this->get_field_id( 'random' ); ?>"><?php esc_html_e( 'Random Order:', 'jetpack' ); ?></label> |
| 59 |
<?php $checked = ''; |
| 60 |
|
| 61 |
if ( isset( $instance['random'] ) && $instance['random'] ) |
| 62 |
$checked = 'checked="checked"'; |
| 63 |
|
| 64 |
?> |
| 65 |
<input name="<?php echo $this->get_field_name( 'random' ); ?>" id="<?php echo $this->get_field_id( 'random' ); ?>" type="checkbox" <?php echo $checked; ?>> |
| 66 |
</p> |
| 67 |
|
| 68 |
<p class="gallery-widget-style-wrapper"> |
| 69 |
<label for="<?php echo $this->get_field_id( 'type' ); ?>"><?php esc_html_e( 'Style:', 'jetpack' ); ?></label> |
| 70 |
<select name="<?php echo $this->get_field_name( 'type' ); ?>" id="<?php echo $this->get_field_id( 'type' ); ?>" class="widefat gallery-widget-style"> |
| 71 |
<?php foreach ( $allowed_values['type'] as $key => $label ) { |
| 72 |
$selected = ''; |
| 73 |
|
| 74 |
if ( $instance['type'] == $key ) { |
| 75 |
$selected = "selected='selected' "; |
| 76 |
} ?> |
| 77 |
|
| 78 |
<option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo esc_html( $label, 'jetpack' ); ?></option> |
| 79 |
<?php } ?> |
| 80 |
</select> |
| 81 |
</p> |
| 82 |
|
| 83 |
<?php |
| 84 |
|
| 85 |
|
| 86 |
?> |
| 87 |
|
| 88 |
<?php // Hidden input to hold the selected image ids as a csv list ?> |
| 89 |
<input type="hidden" class="gallery-widget-ids" name="<?php echo $this->get_field_name( 'ids' ); ?>" id="<?php echo $this->get_field_id( 'ids' ); ?>" value="<?php echo esc_attr( $instance['ids'] ); ?>" /> |
| 90 |
|