/home/techb158/primomovers.ca/wp-content/plugins/everest-forms/includes
Edit: /home/techb158/primomovers.ca/wp-content/plugins/everest-forms/includes/class-evf-fields.php (4828B)
init();
}
/**
* Load fields and hook in functions.
*/
public function init() {
$load_fields = apply_filters(
'everest_forms_fields',
array(
'EVF_Field_First_Name',
'EVF_Field_Last_Name',
'EVF_Field_Text',
'EVF_Field_Textarea',
'EVF_Field_Select',
'EVF_Field_Radio',
'EVF_Field_Checkbox',
'EVF_Field_Number',
'EVF_Field_Email',
'EVF_Field_URL',
'EVF_Field_Date_Time',
'EVF_Field_Recaptcha',
'EVF_Field_Hcaptcha',
'EVF_Field_Turnstile',
'EVF_Field_AI',
'EVF_Field_File_Upload',
'EVF_Field_Private_Note'
)
);
if ( ! class_exists( '\EverestForms\AI' ) ) {
$load_fields = array_diff( $load_fields, array( 'EVF_Field_AI' ) );
}
// Get sort order.
$order_end = 999;
// Load form fields.
foreach ( $load_fields as $field ) {
$load_field = is_string( $field ) ? new $field() : $field;
if ( isset( $load_field->order ) && is_numeric( $load_field->order ) ) {
// Add in position.
$this->form_fields[ $load_field->group ][ $load_field->order ] = $load_field;
} else {
// Add to end of the array.
$this->form_fields[ $load_field->group ][ $order_end ] = $load_field;
++$order_end;
}
ksort( $this->form_fields[ $load_field->group ] );
}
}
/**
* Get fields.
*
* @return array
*/
public function form_fields() {
$_available_fields = array();
if ( count( $this->form_fields ) > 0 ) {
foreach ( $this->form_fields as $group => $field ) {
$_available_fields[ $group ] = $field;
}
}
return $_available_fields;
}
/**
* Get array of registered field types.
*
* @return array of strings
*/
public function get_form_field_types() {
$_available_fields = array();
if ( count( $this->form_fields ) > 0 ) {
foreach ( array_values( $this->form_fields ) as $form_field ) {
foreach ( $form_field as $field ) {
$_available_fields[] = $field->type;
}
}
}
return $_available_fields;
}
/**
* Get array of registered "Pro" field types.
*
* @return array of strings
*/
public function get_pro_form_field_types() {
$_available_fields = array();
if ( count( $this->form_fields ) > 0 ) {
foreach ( array_values( $this->form_fields ) as $form_field ) {
foreach ( $form_field as $field ) {
if ( $field->is_pro ) {
$_available_fields[] = $field->type;
}
}
}
}
return $_available_fields;
}
/**
* Get metadata for all registered "Pro" (lockable) field types.
*
* Used by the upsell UI (builder locked-field overlay, AI preview) and as
* the canonical list of Pro fields the AI form generator may surface.
*
* @since 3.2.0
*
* @return array Map of field type => metadata ( name, icon, group, addon, plan, links ).
*/
public function get_pro_fields_meta() {
$meta = array();
if ( count( $this->form_fields ) > 0 ) {
foreach ( array_values( $this->form_fields ) as $form_field ) {
foreach ( $form_field as $field ) {
if ( empty( $field->is_pro ) ) {
continue;
}
$meta[ $field->type ] = array(
'type' => $field->type,
'name' => isset( $field->name ) ? $field->name : $field->type,
'icon' => isset( $field->icon ) ? $field->icon : '',
'group' => isset( $field->group ) ? $field->group : '',
'addon' => isset( $field->addon ) ? $field->addon : '',
'plan' => isset( $field->plan ) ? $field->plan : '',
'links' => isset( $field->links ) ? $field->links : array(),
);
}
}
}
return apply_filters( 'everest_forms_pro_fields_meta', $meta );
}
}