$attributes Block attributes. * @since 0.0.2 */ public function __construct( $attributes ) { $this->slug = 'input'; $this->max_text_length = $attributes['textLength'] ?? ''; $this->input_mask = $attributes['inputMask'] ?? ''; $this->custom_input_mask = 'custom-mask' === $this->input_mask && isset( $attributes['customInputMask'] ) ? $attributes['customInputMask'] : ''; $this->set_properties( $attributes ); $this->read_only = ! empty( $this->default ) && $attributes['readOnly']; $this->set_input_label( __( 'Text field', 'sureforms' ) ); $this->set_error_msg( $attributes, 'srfm_input_block_required_text' ); $this->set_duplicate_msg( $attributes, 'srfm_input_block_unique_text' ); $this->set_unique_slug(); $this->set_field_name( $this->unique_slug ); $this->set_markup_properties( $this->input_label, true ); $this->set_aria_described_by(); $this->set_label_as_placeholder( $this->input_label ); } /** * Render input markup * * @since 0.0.2 * @return string|bool */ public function markup() { $data_config = $this->field_config; $this->class_name = $this->get_field_classes( $this->read_only ? [ 'srfm-read-only' ] : [] ); 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 ); ?>" maxlength="max_text_length ); ?>" value="default ); ?>" placeholder_attr ); ?> data-srfm-mask="input_mask ); ?>" custom_input_mask ) ? 'data-custom-srfm-mask="' . esc_attr( $this->custom_input_mask ) . '"' : ''; ?> read_only ? 'readonly' : ''; ?> />
duplicate_msg_markup ); ?>