name = __( 'Website URL', 'weforms' );
$this->input_type = 'website_url';
$this->icon = 'link';
}
/**
* Render the text field
*
* @param array $field_settings
* @param integer $form_id
*
* @return void
*/
public function render( $field_settings, $form_id ) {
$value = $field_settings['default'];
?>
print_list_attributes( $field_settings ); ?>>
print_label( $field_settings, $form_id ); ?>
help_text( $field_settings ); ?>
get_default_option_settings();
$default_text_options = $this->get_default_text_option_settings( false ); // word_restriction = false
$check_duplicate = array(
array(
'name' => 'duplicate',
'title' => 'No Duplicates',
'type' => 'checkbox',
'is_single_opt' => true,
'options' => array(
'no' => __( 'Unique Values Only', 'weforms' )
),
'default' => '',
'section' => 'advanced',
'priority' => 23,
'help_text' => __( 'Select this option to limit user input to unique values only. This will require that a value entered in a field does not currently exist in the entry database for that field.', 'weforms' ),
)
);
return array_merge( $default_options, $default_text_options, $check_duplicate );
}
/**
* Get the field props
*
* @return array
*/
public function get_field_props() {
$defaults = $this->default_attributes();
$defaults['duplicate'] = '';
return $defaults;
}
/**
* Prepare entry
*
* @param $field
*
* @return mixed
*/
public function prepare_entry( $field ) {
return esc_url( trim( $_POST[$field['name']] ) );
}
}