8889841cPK [:L= = class-field.phpnu [ name = 'Mailchimp'; $this->type = 'mailchimp'; $this->icon = 'fa-envelope-o'; $this->order = 21; $this->defaults = array( array( 'label' => __( 'Sign-up to our newsletter?', 'mailchimp-for-wp' ), 'value' => '1', 'default' => '', ), ); } /** * Field options panel inside the builder. * * @since 1.0.0 * @param array $field */ public function field_options( $field ) { //--------------------------------------------------------------------// // Basic field options //--------------------------------------------------------------------// // Options open markup $this->field_option( 'basic-options', $field, array( 'markup' => 'open' ) ); // Mailchimp list $this->field_option_mailchimp_list( $field ); // Choices $this->field_option_choices( $field ); // Description $this->field_option( 'description', $field ); // Required toggle $this->field_option( 'required', $field ); // Options close markup $this->field_option( 'basic-options', $field, array( 'markup' => 'close' ) ); //--------------------------------------------------------------------// // Advanced field options //--------------------------------------------------------------------// // Options open markup $this->field_option( 'advanced-options', $field, array( 'markup' => 'open' ) ); // Custom CSS classes $this->field_option( 'css', $field ); // Options close markup $this->field_option( 'advanced-options', $field, array( 'markup' => 'close' ) ); } private function field_option_mailchimp_list( $field ) { $mailchimp = new MC4WP_MailChimp(); // Field option label $tooltip = __( 'Select the Mailchimp list to subscribe to.', 'mailchimp-for-wp' ); $option_label = $this->field_element( 'label', $field, array( 'slug' => 'mailchimp-list', 'value' => __( 'Mailchimp list', 'mailchimp-for-wp' ), 'tooltip' => $tooltip, ), false ); $option_select = sprintf( ''; // Field option row (markup) including label and input. $output = $this->field_element( 'row', $field, array( 'slug' => 'mailchimp-list', 'content' => $option_label . $option_select, ) ); } private function field_option_choices( $field ) { $tooltip = __( 'Set your sign-up label text and whether it should be pre-checked.', 'mailchimp-for-wp' ); $values = ! empty( $field['choices'] ) ? $field['choices'] : $this->defaults; $class = ! empty( $field['show_values'] ) && (int) $field['show_values'] === 1 ? 'show-values' : ''; $class .= ! empty( $dynamic ) ? ' wpforms-hidden' : ''; // Field option label $option_label = $this->field_element( 'label', $field, array( 'slug' => 'mailchimp-checkbox', 'value' => __( 'Sign-up checkbox', 'mailchimp-for-wp' ), 'tooltip' => $tooltip, ), false ); // Field option choices inputs $option_choices = sprintf( '
your WPForms forms.', 'mailchimp-for-wp' ), admin_url( 'admin.php?page=wpforms-overview' ) ); ?>
PK [M=q bootstrap.phpnu [ $field ) { if ( $field['type'] === 'mailchimp' && (int) $field['value_raw'] === 1 ) { return $this->subscribe_from_wpforms( $field_id, $fields, $form_data ); } } } public function subscribe_from_wpforms( $checkbox_field_id, $fields, $form_data ) { foreach ( $fields as $field ) { if ( $field['type'] === 'email' ) { $email_address = $field['value']; } } $mailchimp_list_id = $form_data['fields'][ $checkbox_field_id ]['mailchimp_list']; $this->options['lists'] = array( $mailchimp_list_id ); if ( ! empty( $email_address ) ) { return $this->subscribe( array( 'EMAIL' => $email_address ), $form_data['id'] ); } } /** * @param int $form_id * @return string */ public function get_object_link( $form_id ) { return 'WPForms'; } } PK [:L= = class-field.phpnu [ PK [{ | admin-before.phpnu [ PK [M=q bootstrap.phpnu [ PK [=sw w ! class-wpforms.phpnu [ PK = (