$attributes Block attributes. * @since 0.0.2 */ public function __construct( $attributes ) { $this->set_properties( $attributes ); $this->set_input_label( __( 'Email', 'sureforms' ) ); $this->set_error_msg( $attributes, 'srfm_email_block_required_text' ); $this->set_duplicate_msg( $attributes, 'srfm_email_block_unique_text' ); $this->slug = 'email'; $this->is_confirm_email = $attributes['isConfirmEmail'] ?? false; $this->input_confirm_label_fallback = __( 'Confirm ', 'sureforms' ) . $this->input_label_fallback; $this->input_confirm_label = '-lbl-' . Helper::encode( $this->input_confirm_label_fallback ); $this->unique_confirm_slug = 'srfm-' . $this->slug . '-confirm-' . $this->block_id . $this->input_confirm_label; $this->read_only = ! empty( trim( $this->default ) ) && $attributes['readOnly']; $this->set_unique_slug(); $this->set_field_name( $this->unique_slug ); $this->set_markup_properties( $this->input_label, true ); $this->set_aria_described_by(); // Translators: %s is label of block. $this->confirm_label = ! empty( $attributes['confirmLabel'] ) ? sanitize_text_field( $attributes['confirmLabel'] ) : sprintf( __( 'Confirm %s', 'sureforms' ), $this->label ); $this->set_label_as_placeholder( $this->input_label ); } /** * Render the sureforms email classic styling * * @since 0.0.2 * @return string|bool */ public function markup() { $extra_classes = [ 'srfm-' . $this->slug . '-block-wrap', ]; if ( $this->read_only ) { $extra_classes[] = 'srfm-read-only'; } $this->class_name = $this->get_field_classes( $extra_classes ); ob_start(); ?>
label_markup ); ?> help_markup ); ?>
aria_described_by ) ? "aria-describedby='" . esc_attr( trim( $this->aria_described_by ) ) . "'" : ''; ?> data-required="data_require_attr ) ); ?>" aria-required="data_require_attr ); ?>" data-unique="aria_unique ); ?>" value="default ); ?>" placeholder_attr ); ?> read_only ? 'readonly' : ''; ?> />
duplicate_msg_markup ); ?>
is_confirm_email ) { $confirm_label_markup = Helper::generate_common_form_markup( $this->form_id, 'label', $this->confirm_label, $this->slug . '-confirm', $this->block_id . $this->input_confirm_label, boolval( $this->required ) ); $placeholder = Helper::generate_common_form_markup( $this->form_id, 'placeholder', $this->confirm_label, $this->slug, $this->block_id . $this->block_id . $this->input_confirm_label, boolval( $this->required ) ); $this->placeholder_attr = ''; if ( ! empty( $placeholder ) ) { $confirm_label_markup = ''; $this->placeholder_attr = ' placeholder="' . esc_attr( $placeholder ) . '" '; } $confirm_error_markup = Helper::generate_common_form_markup( $this->form_id, 'error', '', '', $this->block_id, boolval( $this->required ), '', $this->error_msg, false, '', true ); ?>
aria_described_by ) ? "aria-describedby='" . esc_attr( trim( $this->aria_described_by ) ) . "'" : ''; ?> data-required="data_require_attr ); ?>" aria-required="data_require_attr ); ?>" value="default ); ?>" placeholder_attr ); ?> read_only ? 'readonly' : ''; ?> />
$this->slug, 'is_editing' => $this->is_editing, 'field_name' => $this->field_name, 'attributes' => $this->attributes, ] ); } }