| @@ -11,23 +11,23 @@ | ||
| 11 | 11 | <!-- Form --> |
| 12 | 12 | <div> |
| 13 | 13 | <label for="wp-convertkit-quick-edit-form"> |
| 14 | 14 | <span class="title convertkit-icon-form"><?php esc_html_e( 'Form', 'convertkit' ); ?></span> |
| 15 | - <select name="wp-convertkit[form]" id="wp-convertkit-quick-edit-form" size="1"> | |
| 16 | - <option value="-1" data-preserve-on-refresh="1"><?php esc_html_e( 'Default', 'convertkit' ); ?></option> | |
| 17 | - <option value="0" data-preserve-on-refresh="1"><?php esc_html_e( 'None', 'convertkit' ); ?></option> | |
| 18 | - <?php | |
| 19 | - if ( $convertkit_forms->exist() ) { | |
| 20 | - foreach ( $convertkit_forms->get() as $form ) { | |
| 21 | - ?> | |
| 22 | - <option value="<?php echo esc_attr( $form['id'] ); ?>"><?php echo esc_attr( $form['name'] ); ?></option> | |
| 23 | - <?php | |
| 24 | - } | |
| 25 | - } | |
| 26 | - ?> | |
| 27 | - </select> | |
| 15 | + | |
| 16 | + <?php | |
| 17 | + $convertkit_forms->output_select_field_all( | |
| 18 | + 'wp-convertkit[form]', | |
| 19 | + 'wp-convertkit-quick-edit-form', | |
| 20 | + false, | |
| 21 | + false, | |
| 22 | + array( | |
| 23 | + '-1' => esc_html__( 'Default', 'convertkit' ), | |
| 24 | + '0' => esc_html__( 'None', 'convertkit' ), | |
| 25 | + ) | |
| 26 | + ); | |
| 27 | + ?> | |
| 28 | 28 | </label> |
| 29 | - <button class="wp-convertkit-refresh-resources" class="button button-secondary" title="<?php esc_attr_e( 'Refresh Forms from ConvertKit account', 'convertkit' ); ?>" data-resource="forms" data-field="#wp-convertkit-quick-edit-form"> | |
| 29 | + <button class="wp-convertkit-refresh-resources" class="button button-secondary" title="<?php esc_attr_e( 'Refresh Forms from Kit account', 'convertkit' ); ?>" data-resource="forms" data-field="#wp-convertkit-quick-edit-form"> | |
| 30 | 30 | <span class="dashicons dashicons-update"></span> |
| 31 | 31 | </button> |
| 32 | 32 | </div> |
| 33 | 33 | |
| @@ -47,9 +47,9 @@ | ||
| 47 | 47 | } |
| 48 | 48 | ?> |
| 49 | 49 | </select> |
| 50 | 50 | </label> |
| 51 | - <button class="wp-convertkit-refresh-resources" class="button button-secondary" title="<?php esc_attr_e( 'Refresh Tags from ConvertKit account', 'convertkit' ); ?>" data-resource="tags" data-field="#wp-convertkit-quick-edit-tag"> | |
| 51 | + <button class="wp-convertkit-refresh-resources" class="button button-secondary" title="<?php esc_attr_e( 'Refresh Tags from Kit account', 'convertkit' ); ?>" data-resource="tags" data-field="#wp-convertkit-quick-edit-tag"> | |
| 52 | 52 | <span class="dashicons dashicons-update"></span> |
| 53 | 53 | </button> |
| 54 | 54 | </div> |
| 55 | 55 | |
| @@ -57,44 +57,54 @@ | ||
| 57 | 57 | <div> |
| 58 | 58 | <label for="wp-convertkit-quick-edit-restrict_content"> |
| 59 | 59 | <span class="title convertkit-icon-restrict-content"><?php esc_html_e( 'Member', 'convertkit' ); ?></span> |
| 60 | 60 | <select name="wp-convertkit[restrict_content]" id="wp-convertkit-quick-edit-restrict_content" size="1"> |
| 61 | - <option value="0" data-preserve-on-refresh="1"><?php esc_html_e( 'Don\'t restrict content to members only.', 'convertkit' ); ?></option> | |
| 61 | + <option value="0" data-preserve-on-refresh="1"><?php esc_html_e( 'Don\'t restrict content to member-only.', 'convertkit' ); ?></option> | |
| 62 | 62 | |
| 63 | - <?php | |
| 64 | - // Tags. | |
| 65 | - if ( $convertkit_tags->exist() ) { | |
| 63 | + <optgroup label="<?php esc_attr_e( 'Forms', 'convertkit' ); ?>" data-resource="forms"> | |
| 64 | + <?php | |
| 65 | + // Forms. | |
| 66 | + if ( $convertkit_forms->inline_exist() ) { | |
| 67 | + foreach ( $convertkit_forms->get_inline() as $convertkit_form ) { | |
| 68 | + printf( | |
| 69 | + '<option value="form_%s">%s [%s]</option>', | |
| 70 | + esc_attr( $convertkit_form['id'] ), | |
| 71 | + esc_attr( $convertkit_form['name'] ), | |
| 72 | + ( ! empty( $convertkit_form['format'] ) ? esc_attr( $convertkit_form['format'] ) : 'inline' ) | |
| 73 | + ); | |
| 74 | + } | |
| 75 | + } | |
| 66 | 76 | ?> |
| 67 | - <optgroup label="<?php esc_attr_e( 'Tags', 'convertkit' ); ?>"> | |
| 68 | - <?php | |
| 77 | + </optgroup> | |
| 78 | + | |
| 79 | + <optgroup label="<?php esc_attr_e( 'Tags', 'convertkit' ); ?>" data-resource="tags"> | |
| 80 | + <?php | |
| 81 | + // Tags. | |
| 82 | + if ( $convertkit_tags->exist() ) { | |
| 69 | 83 | foreach ( $convertkit_tags->get() as $convertkit_tag ) { |
| 70 | 84 | ?> |
| 71 | 85 | <option value="tag_<?php echo esc_attr( $convertkit_tag['id'] ); ?>"><?php echo esc_attr( $convertkit_tag['name'] ); ?></option> |
| 72 | 86 | <?php |
| 73 | 87 | } |
| 74 | - ?> | |
| 75 | - </optgroup> | |
| 88 | + } | |
| 89 | + ?> | |
| 90 | + </optgroup> | |
| 91 | + | |
| 92 | + <optgroup label="<?php esc_attr_e( 'Products', 'convertkit' ); ?>" data-resource="products"> | |
| 76 | 93 | <?php |
| 77 | - } | |
| 78 | - | |
| 79 | - // Products. | |
| 80 | - if ( $convertkit_products->exist() ) { | |
| 81 | - ?> | |
| 82 | - <optgroup label="<?php esc_attr_e( 'Products', 'convertkit' ); ?>"> | |
| 83 | - <?php | |
| 94 | + // Products. | |
| 95 | + if ( $convertkit_products->exist() ) { | |
| 84 | 96 | foreach ( $convertkit_products->get() as $product ) { |
| 85 | 97 | ?> |
| 86 | 98 | <option value="product_<?php echo esc_attr( $product['id'] ); ?>"><?php echo esc_attr( $product['name'] ); ?></option> |
| 87 | 99 | <?php |
| 88 | 100 | } |
| 89 | - ?> | |
| 90 | - </optgroup> | |
| 91 | - <?php | |
| 92 | - } | |
| 93 | - ?> | |
| 101 | + } | |
| 102 | + ?> | |
| 103 | + </optgroup> | |
| 94 | 104 | </select> |
| 95 | 105 | </label> |
| 96 | - <button class="wp-convertkit-refresh-resources" class="button button-secondary" title="<?php esc_attr_e( 'Refresh Products from ConvertKit account', 'convertkit' ); ?>" data-resource="products" data-field="#wp-convertkit-quick-edit-restrict_content"> | |
| 106 | + <button class="wp-convertkit-refresh-resources" class="button button-secondary" title="<?php esc_attr_e( 'Refresh Products and Tags from Kit account', 'convertkit' ); ?>" data-resource="restrict_content" data-field="#wp-convertkit-quick-edit-restrict_content"> | |
| 97 | 107 | <span class="dashicons dashicons-update"></span> |
| 98 | 108 | </button> |
| 99 | 109 | </div> |
| 100 | 110 | <?php |