<?php

if ( ! class_exists( 'GFForms' ) ) {
	die();
}

class Wiaas_Field_Order_Number extends GF_Field_Number {

	public $type = 'wiaas_order';

	function get_form_editor_field_settings() {
		return array(
			'conditional_logic_field_setting',
			'prepopulate_field_setting',
			'error_message_setting',
			'label_setting',
			'label_placement_setting',
			'admin_label_setting',
			'size_setting',
			'rules_setting',
			'visibility_setting',
			'duplicate_setting',
			'default_value_setting',
			'placeholder_setting',
			'description_setting',
			'css_class_setting',
		);
	}

	public function sanitize_settings() {
		parent::sanitize_settings();
	}


	public function get_form_editor_field_title() {
		return esc_attr__( 'Order Number', 'wiaas' );
	}

	public function add_button( $field_groups ) {
		$field_groups = Wiaas_Order_Fields::maybe_add_order_field_group($field_groups);

		return parent::add_button( $field_groups );
	}

	public function get_form_editor_button() {
		return array(
			'group' => 'wiaas_order_fields',
			'text'  => $this->get_form_editor_field_title(),
		);
	}


	public function get_value_entry_list( $value, $entry, $field_id, $columns, $form ) {
		return "#100000$value";
	}

	public function get_value_entry_detail( $value, $currency = '', $use_text = false, $format = 'html', $media = 'screen' ) {
		return "#100000$value";
	}

	public function get_value_merge_tag( $value, $input_id, $entry, $form, $modifier, $raw_value, $url_encode, $esc_html, $format, $nl2br ) {
		return "#100000$value";
	}
}

GF_Fields::register( new Wiaas_Field_Order_Number() );