| 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-widget-field ayg-widget-field-title"> |
| 14 |
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title', 'automatic-youtube-gallery' ); ?></label> |
| 15 |
<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'] ); ?>" /> |
| 16 |
</div> |
| 17 |
|
| 18 |
<div class="ayg-editor ayg-editor-field-type-<?php echo esc_attr( $instance['type'] ); ?> ayg-editor-field-theme-<?php echo esc_attr( $instance['theme'] ); ?>"> |
| 19 |
<?php foreach ( $fields as $key => $value ) : ?> |
| 20 |
<div class="ayg-editor-section ayg-editor-section-<?php echo esc_attr( $key ); ?> <?php if ( 'source' == $key ) echo 'ayg-active'; ?>"> |
| 21 |
<div class="ayg-editor-section-header"> |
| 22 |
<span class="dashicons-before dashicons-plus"></span> |
| 23 |
<span class="dashicons-before dashicons-minus"></span> |
| 24 |
<?php echo esc_html( $value['label'] ); ?> |
| 25 |
</div> |
| 26 |
|
| 27 |
<div class="ayg-editor-controls" <?php if ( 'source' != $key ) echo 'style="display: none;"'; ?>> |
| 28 |
<?php |
| 29 |
foreach ( $value['fields'] as $field ) : |
| 30 |
if ( ! isset( $field['placeholder'] ) ) { |
| 31 |
$field['placeholder'] = ''; |
| 32 |
} |
| 33 |
|
| 34 |
$field['value'] = $instance[ $field['name'] ]; |
| 35 |
?> |
| 36 |
<div class="ayg-editor-control ayg-editor-control-<?php echo esc_attr( $field['name'] ); ?>"> |
| 37 |
<?php if ( 'text' == $field['type'] || 'url' == $field['type'] || 'number' == $field['type'] ) : ?> |
| 38 |
<label><?php echo esc_html( $field['label'] ); ?></label> |
| 39 |
<input type="text" name="<?php echo esc_attr( $this->get_field_name( $field['name'] ) ); ?>" class="ayg-editor-field ayg-editor-field-<?php echo esc_attr( $field['name'] ); ?> widefat" placeholder="<?php echo esc_attr( $field['placeholder'] ); ?>" value="<?php echo esc_attr( $field['value'] ); ?>" /> |
| 40 |
<?php elseif ( 'textarea' == $field['type'] ) : ?> |
| 41 |
<label><?php echo esc_html( $field['label'] ); ?></label> |
| 42 |
<textarea name="<?php echo esc_attr( $this->get_field_name( $field['name'] ) ); ?>" rows="8" class="ayg-editor-field ayg-editor-field-<?php echo esc_attr( $field['name'] ); ?> widefat" placeholder="<?php echo esc_attr( $field['placeholder'] ); ?>"><?php echo esc_textarea( $field['value'] ); ?></textarea> |
| 43 |
<?php elseif ( 'select' == $field['type'] || 'radio' == $field['type'] ) : ?> |
| 44 |
<label><?php echo esc_html( $field['label'] ); ?></label> |
| 45 |
<select name="<?php echo esc_attr( $this->get_field_name( $field['name'] ) ); ?>" class="ayg-editor-field ayg-editor-field-<?php echo esc_attr( $field['name'] ); ?> widefat"> <?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> |
| 58 |
<input type="checkbox" name="<?php echo esc_attr( $this->get_field_name( $field['name'] ) ); ?>" class="ayg-editor-field ayg-editor-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><?php echo esc_html( $field['label'] ); ?></label> |
| 63 |
<input type="text" name="<?php echo esc_attr( $this->get_field_name( $field['name'] ) ); ?>" class="ayg-editor-field ayg-editor-field-<?php echo esc_attr( $field['name'] ); ?> ayg-color-picker widefat" value="<?php echo esc_attr( $field['value'] ); ?>" /> |
| 64 |
<?php endif; ?> |
| 65 |
|
| 66 |
<!-- Hint --> |
| 67 |
<?php if ( ! empty( $field['description'] ) ) : ?> |
| 68 |
<p class="description"><?php echo wp_kses_post( $field['description'] ); ?></p> |
| 69 |
<?php endif; ?> |
| 70 |
</div> |
| 71 |
<?php |
| 72 |
endforeach; |
| 73 |
?> |
| 74 |
</div> |
| 75 |
</div> |
| 76 |
<?php endforeach; ?> |
| 77 |
</div> |
| 78 |
|