| @@ -9,69 +9,69 @@ | ||
| 9 | 9 | * @package Automatic_YouTube_Gallery |
| 10 | 10 | */ |
| 11 | 11 | ?> |
| 12 | 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> | |
| 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> | |
| 18 | 17 | |
| 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> | |
| 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> | |
| 25 | 26 | |
| 26 | - <div class="ayg-form-controls"> | |
| 27 | - <?php | |
| 28 | - foreach ( $value['fields'] as $field ) : | |
| 29 | - if ( ! isset( $field['placeholder'] ) ) { | |
| 30 | - $field['placeholder'] = ''; | |
| 31 | - } | |
| 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 | + } | |
| 32 | 33 | |
| 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; | |
| 34 | + $field['value'] = $instance[ $field['name'] ]; | |
| 72 | 35 | ?> |
| 73 | - </div> | |
| 74 | - </details> | |
| 75 | - <?php endforeach; ?> | |
| 76 | - </div> | |
| 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 | 77 | </div> |