| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Widget admin form. |
| 5 |
* |
| 6 |
* @link https://plugins360.com |
| 7 |
* @since 2.1.0 |
| 8 |
* |
| 9 |
* @package Automatic_YouTube_Gallery |
| 10 |
*/ |
| 11 |
?> |
| 12 |
|
| 13 |
<div class="ayg ayg-widget ayg-widget-form"> |
| 14 |
<div class="ayg-widget-field ayg-widget-field-title"> |
| 15 |
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title', 'automatic-youtube-gallery' ); ?></label> |
| 16 |
<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" class="widefat" value="<?php echo esc_attr( $instance['title'] ); ?>" /> |
| 17 |
</div> |
| 18 |
|
| 19 |
<div class="ayg-form ayg-form-field-type-<?php echo esc_attr( $instance['type'] ); ?> ayg-form-field-theme-<?php echo esc_attr( $instance['theme'] ); ?>"> |
| 20 |
<?php foreach ( $fields as $key => $value ) : ?> |
| 21 |
<details class="ayg-form-section-<?php echo esc_attr( $key ); ?>"<?php if ( 'source' == $key ) echo ' open'; ?>> |
| 22 |
<summary> |
| 23 |
<span><?php echo esc_html( $value['label'] ); ?></span> |
| 24 |
</summary> |
| 25 |
|
| 26 |
<div class="ayg-form-controls"> |
| 27 |
<?php |
| 28 |
foreach ( $value['fields'] as $field ) : |
| 29 |
if ( ! isset( $field['placeholder'] ) ) { |
| 30 |
$field['placeholder'] = ''; |
| 31 |
} |
| 32 |
|
| 33 |
$field['value'] = $instance[ $field['name'] ]; |
| 34 |
?> |
| 35 |
<div class="ayg-form-control ayg-form-control-<?php echo esc_attr( $field['name'] ); ?>"> |
| 36 |
<?php if ( 'text' == $field['type'] || 'url' == $field['type'] || 'number' == $field['type'] ) : ?> |
| 37 |
<label class="ayg-form-label" for="<?php echo esc_attr( $this->get_field_id( $field['name'] ) ); ?>"><?php echo esc_html( $field['label'] ); ?></label> |
| 38 |
<input type="text" name="<?php echo esc_attr( $this->get_field_name( $field['name'] ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( $field['name'] ) ); ?>" class="ayg-form-field ayg-form-field-<?php echo esc_attr( $field['name'] ); ?> widefat" placeholder="<?php echo esc_attr( $field['placeholder'] ); ?>" value="<?php echo esc_attr( $field['value'] ); ?>" /> |
| 39 |
<?php elseif ( 'textarea' == $field['type'] ) : ?> |
| 40 |
<label class="ayg-form-label" for="<?php echo esc_attr( $this->get_field_id( $field['name'] ) ); ?>"><?php echo esc_html( $field['label'] ); ?></label> |
| 41 |
<textarea name="<?php echo esc_attr( $this->get_field_name( $field['name'] ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( $field['name'] ) ); ?>" rows="8" class="ayg-form-field ayg-form-field-<?php echo esc_attr( $field['name'] ); ?> widefat" placeholder="<?php echo esc_attr( $field['placeholder'] ); ?>"><?php echo esc_textarea( $field['value'] ); ?></textarea> |
| 42 |
<?php elseif ( 'select' == $field['type'] || 'radio' == $field['type'] ) : ?> |
| 43 |
<label class="ayg-form-label" for="<?php echo esc_attr( $this->get_field_id( $field['name'] ) ); ?>"><?php echo esc_html( $field['label'] ); ?></label> |
| 44 |
<select name="<?php echo esc_attr( $this->get_field_name( $field['name'] ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( $field['name'] ) ); ?>" class="ayg-form-field ayg-form-field-<?php echo esc_attr( $field['name'] ); ?> widefat"> |
| 45 |
<?php |
| 46 |
foreach ( $field['options'] as $value => $label ) { |
| 47 |
printf( |
| 48 |
'<option value="%s"%s>%s</option>', |
| 49 |
esc_attr( $value ), |
| 50 |
selected( $value, $field['value'], false ), |
| 51 |
esc_html( $label ) |
| 52 |
); |
| 53 |
} |
| 54 |
?> |
| 55 |
</select> |
| 56 |
<?php elseif ( 'checkbox' == $field['type'] ) : ?> |
| 57 |
<label class="ayg-form-label" for="<?php echo esc_attr( $this->get_field_id( $field['name'] ) ); ?>"> |
| 58 |
<input type="checkbox" name="<?php echo esc_attr( $this->get_field_name( $field['name'] ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( $field['name'] ) ); ?>" class="ayg-form-field ayg-form-field-<?php echo esc_attr( $field['name'] ); ?>" value="1" <?php checked( $field['value'] ); ?> /> |
| 59 |
<?php echo esc_html( $field['label'] ); ?> |
| 60 |
</label> |
| 61 |
<?php elseif ( 'color' == $field['type'] ) : ?> |
| 62 |
<label class="ayg-form-label" for="<?php echo esc_attr( $this->get_field_id( $field['name'] ) ); ?>"><?php echo esc_html( $field['label'] ); ?></label> |
| 63 |
<input type="text" name="<?php echo esc_attr( $this->get_field_name( $field['name'] ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( $field['name'] ) ); ?>" class="ayg-form-field ayg-form-field-<?php echo esc_attr( $field['name'] ); ?> ayg-color-picker widefat" value="<?php echo esc_attr( $field['value'] ); ?>" /> |
| 64 |
<?php endif; ?> |
| 65 |
|
| 66 |
<?php if ( ! empty( $field['description'] ) ) : ?> |
| 67 |
<p class="description"><?php echo wp_kses_post( $field['description'] ); ?></p> |
| 68 |
<?php endif; ?> |
| 69 |
</div> |
| 70 |
<?php |
| 71 |
endforeach; |
| 72 |
?> |
| 73 |
</div> |
| 74 |
</details> |
| 75 |
<?php endforeach; ?> |
| 76 |
</div> |
| 77 |
</div> |
| 78 |
|