PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 3.4.3
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v3.4.3
3.4.3 3.4.2 3.4.1 3.4.0 3.3.9 3.3.8 3.3.7 3.3.6 3.3.5 3.3.4 3.3.3 3.3.2 3.3.1 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 2.3.1 All 196 releases
convertkit / views / backend / subscription-dropdown-field.php

subscription-dropdown-field.php in Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages 3.4.3, at views/backend/subscription-dropdown-field.php

101 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Outputs a dropdown field comprising of options covering:
4 * - Do not subscribe
5 * - Subscribe
6 * - Forms
7 *
8 * @package ConvertKit
9 * @author ConvertKit
10 */
11
12 ?>
13 <select class="<?php echo esc_attr( $css_class ); ?>" id="<?php echo esc_attr( $id ); ?>" name="<?php echo esc_attr( $name ); ?>">
14 <option <?php selected( '', $value ); ?> value="" data-preserve-on-refresh="1">
15 <?php esc_html_e( '(Do not subscribe)', 'convertkit' ); ?>
16 </option>
17
18 <option <?php selected( 'subscribe', $value ); ?> value="subscribe" data-preserve-on-refresh="1">
19 <?php esc_html_e( 'Subscribe', 'convertkit' ); ?>
20 </option>
21
22 <?php
23 // Output additional options, if defined.
24 if ( is_array( $additional_options ) ) {
25 foreach ( $additional_options as $additional_option_key => $additional_option_value ) {
26 printf(
27 '<option value="%s"%s>%s</option>',
28 esc_attr( $additional_option_key ),
29 selected( $additional_option_key, $value, false ),
30 esc_attr( $additional_option_value )
31 );
32 }
33 }
34 ?>
35
36 <optgroup label="<?php esc_attr_e( 'Forms', 'convertkit' ); ?>" id="convertkit-forms" data-option-value-prefix="form:">
37 <?php
38 $non_legacy_forms = $forms->get_non_legacy();
39 if ( is_array( $non_legacy_forms ) ) {
40 foreach ( $non_legacy_forms as $form ) {
41 printf(
42 '<option value="%s"%s>%s [%s]</option>',
43 esc_attr( 'form:' . $form['id'] ),
44 selected( 'form:' . $form['id'], $value, false ),
45 esc_attr( $form['name'] ),
46 esc_attr( $form['format'] )
47 );
48 }
49 }
50
51 // If the currently-selected value references a legacy form (which is
52 // no longer exposed as a new selection option), append it here so a
53 // previously-saved mapping continues to render as selected.
54 if ( is_string( $value ) && strpos( $value, 'form:' ) === 0 ) {
55 $selected_form_id = (int) substr( $value, 5 );
56 if ( $selected_form_id && $forms->is_legacy( $selected_form_id ) ) {
57 $legacy_form = $forms->get_by_id( $selected_form_id );
58 if ( $legacy_form ) {
59 printf(
60 '<option value="%s" selected>%s [%s]</option>',
61 esc_attr( 'form:' . $legacy_form['id'] ),
62 esc_attr( $legacy_form['name'] ),
63 'inline'
64 );
65 }
66 }
67 }
68 ?>
69 </optgroup>
70
71 <optgroup label="<?php esc_attr_e( 'Sequences', 'convertkit' ); ?>" id="convertkit-sequences" data-option-value-prefix="sequence:">
72 <?php
73 if ( $sequences->exist() ) {
74 foreach ( $sequences->get() as $sequence ) {
75 printf(
76 '<option value="%s"%s>%s</option>',
77 esc_attr( 'sequence:' . $sequence['id'] ),
78 selected( 'sequence:' . $sequence['id'], $value, false ),
79 esc_attr( $sequence['name'] )
80 );
81 }
82 }
83 ?>
84 </optgroup>
85
86 <optgroup label="<?php esc_attr_e( 'Tags', 'convertkit' ); ?>" id="convertkit-tags" data-option-value-prefix="tag:">
87 <?php
88 if ( $tags->exist() ) {
89 foreach ( $tags->get() as $convertkit_tag ) {
90 printf(
91 '<option value="%s"%s>%s</option>',
92 esc_attr( 'tag:' . $convertkit_tag['id'] ),
93 selected( 'tag:' . $convertkit_tag['id'], $value, false ),
94 esc_attr( $convertkit_tag['name'] )
95 );
96 }
97 }
98 ?>
99 </optgroup>
100 </select>
101