namespace WPForms\Forms\Fields\Addons\Signature;
use WPForms\Forms\Fields\Traits\ProField as ProFieldTrait;
class Field extends WPForms_Field {
// Define field type information.
$this->name = esc_html__( 'Signature', 'wpforms-lite' );
$this->keywords = esc_html__( 'user, e-signature', 'wpforms-lite' );
$this->type = 'signature';
$this->icon = 'fa-pencil';
$this->addon_slug = 'signatures';
$this->default_settings = [
protected function hooks() {
* Field options panel inside the builder.
* @param array $field Field settings.
public function field_options( $field ) {
'after_title' => $this->get_field_options_notice(),
$this->field_option( 'label', $field );
$this->field_option( 'description', $field );
$this->field_option( 'required', $field );
* Advanced field options.
$lbl = $this->field_element(
'value' => esc_html__( 'Ink Color', 'wpforms-lite' ),
'tooltip' => esc_html__( 'Select the color for the signature ink.', 'wpforms-lite' ),
$ink_color = isset( $field['ink_color'] ) ? wpforms_sanitize_hex_color( $field['ink_color'] ) : '';
$ink_color = empty( $ink_color ) ? '#000000' : $ink_color;
$fld = $this->field_element(
'fallback-color' => $ink_color,
'content' => $lbl . $fld,
'class' => 'color-picker-row',
$this->field_option( 'css', $field );
$this->field_option( 'size', $field );
$this->field_option( 'label_hide', $field );
* Field preview inside the builder.
* @param array $field Field settings.
public function field_preview( $field ) {
$this->field_preview_option(
'label_badge' => $this->get_field_preview_badge(),
// Signature placeholder.
echo '<div class="wpforms-signature-wrap"></div>';
$this->field_preview_option( 'description', $field );
// Hide remaining elements.
$this->field_preview_option( 'hide-remaining', $field );
* Field display on the form front-end.
* @param array $field Field settings.
* @param array $deprecated Deprecated array.
* @param array $form_data Form data and settings.
public function field_display( $field, $deprecated, $form_data ) {