| @@ -21,204 +21,8 @@ | ||
| 21 | 21 | return esc_html__( 'Email', 'hello-plus' ); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | public function register_settings_section( $widget ) { |
| 25 | - $widget->start_controls_section( | |
| 26 | - $this->get_control_id( 'section_email' ), | |
| 27 | - [ | |
| 28 | - 'label' => $this->get_label(), | |
| 29 | - 'tab' => Controls_Manager::TAB_CONTENT, | |
| 30 | - 'condition' => [ | |
| 31 | - 'submit_actions' => $this->get_name(), | |
| 32 | - ], | |
| 33 | - ] | |
| 34 | - ); | |
| 35 | - | |
| 36 | - $widget->add_control( | |
| 37 | - $this->get_control_id( 'email_to' ), | |
| 38 | - [ | |
| 39 | - 'label' => esc_html__( 'To', 'hello-plus' ), | |
| 40 | - 'type' => Controls_Manager::TEXT, | |
| 41 | - 'default' => get_option( 'admin_email' ), | |
| 42 | - 'ai' => [ | |
| 43 | - 'active' => false, | |
| 44 | - ], | |
| 45 | - 'placeholder' => get_option( 'admin_email' ), | |
| 46 | - 'label_block' => true, | |
| 47 | - 'title' => esc_html__( 'Separate emails with commas', 'hello-plus' ), | |
| 48 | - 'render_type' => 'none', | |
| 49 | - 'dynamic' => [ | |
| 50 | - 'active' => true, | |
| 51 | - ], | |
| 52 | - ] | |
| 53 | - ); | |
| 54 | - | |
| 55 | - /* translators: %s: Site title. */ | |
| 56 | - $default_message = sprintf( esc_html__( 'New message from [%s]', 'hello-plus' ), get_bloginfo( 'name' ) ); | |
| 57 | - | |
| 58 | - $widget->add_control( | |
| 59 | - $this->get_control_id( 'email_subject' ), | |
| 60 | - [ | |
| 61 | - 'label' => esc_html__( 'Subject', 'hello-plus' ), | |
| 62 | - 'type' => Controls_Manager::TEXT, | |
| 63 | - 'default' => $default_message, | |
| 64 | - 'ai' => [ | |
| 65 | - 'active' => false, | |
| 66 | - ], | |
| 67 | - 'placeholder' => $default_message, | |
| 68 | - 'label_block' => true, | |
| 69 | - 'render_type' => 'none', | |
| 70 | - 'dynamic' => [ | |
| 71 | - 'active' => true, | |
| 72 | - ], | |
| 73 | - ] | |
| 74 | - ); | |
| 75 | - | |
| 76 | - $widget->add_control( | |
| 77 | - $this->get_control_id( 'email_content' ), | |
| 78 | - [ | |
| 79 | - 'label' => esc_html__( 'Message', 'hello-plus' ), | |
| 80 | - 'type' => Controls_Manager::TEXTAREA, | |
| 81 | - 'default' => '[all-fields]', | |
| 82 | - 'ai' => [ | |
| 83 | - 'active' => false, | |
| 84 | - ], | |
| 85 | - 'placeholder' => '[all-fields]', | |
| 86 | - 'description' => sprintf( | |
| 87 | - /* translators: %s: The [all-fields] shortcode. */ | |
| 88 | - esc_html__( 'By default, all form fields are sent via %s shortcode. To customize sent fields, copy the shortcode that appears inside each field and paste it above.', 'hello-plus' ), | |
| 89 | - '<code>[all-fields]</code>' | |
| 90 | - ), | |
| 91 | - 'render_type' => 'none', | |
| 92 | - 'dynamic' => [ | |
| 93 | - 'active' => true, | |
| 94 | - ], | |
| 95 | - ] | |
| 96 | - ); | |
| 97 | - | |
| 98 | - $site_domain = Module::get_site_domain(); | |
| 99 | - | |
| 100 | - $widget->add_control( | |
| 101 | - $this->get_control_id( 'email_from' ), | |
| 102 | - [ | |
| 103 | - 'label' => esc_html__( 'From Email', 'hello-plus' ), | |
| 104 | - 'type' => Controls_Manager::TEXT, | |
| 105 | - 'default' => 'email@' . $site_domain, | |
| 106 | - 'ai' => [ | |
| 107 | - 'active' => false, | |
| 108 | - ], | |
| 109 | - 'render_type' => 'none', | |
| 110 | - 'dynamic' => [ | |
| 111 | - 'active' => true, | |
| 112 | - ], | |
| 113 | - ] | |
| 114 | - ); | |
| 115 | - | |
| 116 | - $widget->add_control( | |
| 117 | - $this->get_control_id( 'email_from_name' ), | |
| 118 | - [ | |
| 119 | - 'label' => esc_html__( 'From Name', 'hello-plus' ), | |
| 120 | - 'type' => Controls_Manager::TEXT, | |
| 121 | - 'default' => get_bloginfo( 'name' ), | |
| 122 | - 'ai' => [ | |
| 123 | - 'active' => false, | |
| 124 | - ], | |
| 125 | - 'render_type' => 'none', | |
| 126 | - 'dynamic' => [ | |
| 127 | - 'active' => true, | |
| 128 | - ], | |
| 129 | - ] | |
| 130 | - ); | |
| 131 | - | |
| 132 | - $widget->add_control( | |
| 133 | - $this->get_control_id( 'email_reply_to' ), | |
| 134 | - [ | |
| 135 | - 'label' => esc_html__( 'Reply-To', 'hello-plus' ), | |
| 136 | - 'type' => Controls_Manager::SELECT, | |
| 137 | - 'options' => [ | |
| 138 | - '' => '', | |
| 139 | - ], | |
| 140 | - 'render_type' => 'none', | |
| 141 | - ] | |
| 142 | - ); | |
| 143 | - | |
| 144 | - $widget->add_control( | |
| 145 | - $this->get_control_id( 'email_to_cc' ), | |
| 146 | - [ | |
| 147 | - 'label' => esc_html__( 'Cc', 'hello-plus' ), | |
| 148 | - 'type' => Controls_Manager::TEXT, | |
| 149 | - 'default' => '', | |
| 150 | - 'ai' => [ | |
| 151 | - 'active' => false, | |
| 152 | - ], | |
| 153 | - 'title' => esc_html__( 'Separate emails with commas', 'hello-plus' ), | |
| 154 | - 'render_type' => 'none', | |
| 155 | - 'dynamic' => [ | |
| 156 | - 'active' => true, | |
| 157 | - ], | |
| 158 | - ] | |
| 159 | - ); | |
| 160 | - | |
| 161 | - $widget->add_control( | |
| 162 | - $this->get_control_id( 'email_to_bcc' ), | |
| 163 | - [ | |
| 164 | - 'label' => esc_html__( 'Bcc', 'hello-plus' ), | |
| 165 | - 'type' => Controls_Manager::TEXT, | |
| 166 | - 'default' => '', | |
| 167 | - 'ai' => [ | |
| 168 | - 'active' => false, | |
| 169 | - ], | |
| 170 | - 'title' => esc_html__( 'Separate emails with commas', 'hello-plus' ), | |
| 171 | - 'render_type' => 'none', | |
| 172 | - 'dynamic' => [ | |
| 173 | - 'active' => true, | |
| 174 | - ], | |
| 175 | - ] | |
| 176 | - ); | |
| 177 | - | |
| 178 | - $widget->add_control( | |
| 179 | - $this->get_control_id( 'form_metadata' ), | |
| 180 | - [ | |
| 181 | - 'label' => esc_html__( 'Meta Data', 'hello-plus' ), | |
| 182 | - 'type' => Controls_Manager::SELECT2, | |
| 183 | - 'multiple' => true, | |
| 184 | - 'label_block' => true, | |
| 185 | - 'separator' => 'before', | |
| 186 | - 'default' => [ | |
| 187 | - 'date', | |
| 188 | - 'time', | |
| 189 | - 'page_url', | |
| 190 | - 'user_agent', | |
| 191 | - 'remote_ip', | |
| 192 | - 'credit', | |
| 193 | - ], | |
| 194 | - 'options' => [ | |
| 195 | - 'date' => esc_html__( 'Date', 'hello-plus' ), | |
| 196 | - 'time' => esc_html__( 'Time', 'hello-plus' ), | |
| 197 | - 'page_url' => esc_html__( 'Page URL', 'hello-plus' ), | |
| 198 | - 'user_agent' => esc_html__( 'User Agent', 'hello-plus' ), | |
| 199 | - 'remote_ip' => esc_html__( 'Remote IP', 'hello-plus' ), | |
| 200 | - 'credit' => esc_html__( 'Credit', 'hello-plus' ), | |
| 201 | - ], | |
| 202 | - 'render_type' => 'none', | |
| 203 | - ] | |
| 204 | - ); | |
| 205 | - | |
| 206 | - $widget->add_control( | |
| 207 | - $this->get_control_id( 'email_content_type' ), | |
| 208 | - [ | |
| 209 | - 'label' => esc_html__( 'Send As', 'hello-plus' ), | |
| 210 | - 'type' => Controls_Manager::SELECT, | |
| 211 | - 'default' => 'html', | |
| 212 | - 'render_type' => 'none', | |
| 213 | - 'options' => [ | |
| 214 | - 'html' => esc_html__( 'HTML', 'hello-plus' ), | |
| 215 | - 'plain' => esc_html__( 'Plain', 'hello-plus' ), | |
| 216 | - ], | |
| 217 | - ] | |
| 218 | - ); | |
| 219 | - | |
| 220 | - $widget->end_controls_section(); | |
| 221 | 25 | } |
| 222 | 26 | |
| 223 | 27 | public function on_export( $element ) { |
| 224 | 28 | $controls_to_unset = [ |