$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(); ?>