failed_validation && ! empty( $this->validation_message ) ) ? sprintf( "
%s
", $this->validation_message ) : '';
$is_form_editor = $this->is_form_editor();
$is_entry_detail = $this->is_entry_detail();
$is_admin = $is_form_editor || $is_entry_detail;
$admin_buttons = $this->get_admin_buttons();
$description = $this->get_description( $this->description, 'gfield_description' );
if ( $this->is_description_above( $form ) ) {
$clear = $is_admin ? "" : '';
$field_content = sprintf( "%s%s{FIELD}%s$clear", $admin_buttons, $description, $validation_message );
} else {
$field_content = sprintf( "%s{FIELD}%s%s", $admin_buttons, $description, $validation_message );
}
return $field_content;
}
public function get_form_editor_field_title() {
return esc_attr__( 'MailChimp for WordPress', 'mailchimp-for-wp' );
}
public function get_form_editor_field_settings() {
return array(
'label_setting',
'description_setting',
'css_class_setting',
'mailchimp_list_setting',
'mailchimp_double_optin',
'rules_setting',
);
}
public function get_field_input( $form, $value = '', $entry = null ) {
$form_id = absint( $form['id'] );
$is_entry_detail = $this->is_entry_detail();
$is_form_editor = $this->is_form_editor();
$id = $this->id;
$field_id = $is_entry_detail || $is_form_editor || $form_id == 0 ? "input_$id" : 'input_' . $form_id . "_$id";
$disabled_text = $is_form_editor ? 'disabled="disabled"' : '';
return sprintf( "", esc_attr( $field_id ), $this->get_checkbox_choices( $value, $disabled_text, $form_id ) );
}
public function get_checkbox_choices( $value, $disabled_text, $form_id = 0 ) {
$choices = '';
$is_entry_detail = $this->is_entry_detail();
$is_form_editor = $this->is_form_editor();
$choice = array(
'text' => $this->get_field_label( false, $value ),
'value' => "1",
'isSelected' => false,
);
$input_id = $this->id;
if ( $is_entry_detail || $is_form_editor || $form_id == 0 ){
$id = $this->id;
} else {
$id = $form_id . '_' . $this->id;
}
if ( ! isset( $_GET['gf_token'] ) && empty( $_POST ) && rgar( $choice, 'isSelected' ) ) {
$checked = "checked='checked'";
} elseif ( is_array( $value ) && RGFormsModel::choice_value_match( $this, $choice, rgget( $input_id, $value ) ) ) {
$checked = "checked='checked'";
} elseif ( ! is_array( $value ) && RGFormsModel::choice_value_match( $this, $choice, $value ) ) {
$checked = "checked='checked'";
} else {
$checked = '';
}
$logic_event = $this->get_conditional_logic_event( 'click' );
$tabindex = $this->get_tabindex();
$choice_value = $choice['value'];
$choice_value = esc_attr( $choice_value );
$choice_markup = "
";
$choices .= gf_apply_filters( array(
'gform_field_choice_markup_pre_render',
$this->formId,
$this->id
), $choice_markup, $choice, $this, $value );
return gf_apply_filters( array( 'gform_field_choices', $this->formId, $this->id ), $choices, $this );
}
}