bookmark_borderHelper Functions

Introduction

The following functions, located in GFAddOn, may be used when rendering the individual settings.

settings_text()

Renders and initializes a text input based on the $field array.

protected function settings_text( $field, $echo = true ) {}
  • $field array

    The array containing the field properties.

  • $echo boolean

    Default is true. Indicates whether the field markup should be echoed to the page.

settings_textarea()

Renders and initializes a textarea element based on the $field array.

protected function settings_textarea( $field, $echo = true ) {}
  • $field array

    The array containing the field properties.

  • $echo boolean

    Default is true. Indicates whether the field markup should be echoed to the page.

settings_hidden()

Renders and initializes a hidden input based on the $field array.

protected function settings_hidden( $field, $echo = true ) {}
  • $field array

    The array containing the field properties.

  • $echo boolean

    Default is true. Indicates whether the field markup should be echoed to the page.

settings_radio()

Renders and initializes one or more radio type inputs based on the $field array.

protected function settings_radio( $field, $echo = true ) {}
  • $field array

    The array containing the field properties.

  • $echo boolean

    Default is true. Indicates whether the field markup should be echoed to the page.

choices_have_icon()

Determines if any of the choices for this field have an icon.

public function choices_have_icon( $choices = array() ) {}
  • $choices array

    The array containing the field choices.

get_choice_attributes()

Parses the properties of the $choice array and returns a new array containing a set of HTML attributes to be added to the HTML element.

protected function get_choice_attributes( $choice, $field_attributes, $default_choice_attributes = array() ) {}
  • $choice array

    The choice properties.

  • $field_attributes array

    The fields attributes.

  • $default_choice_attributes array

    The choices default attributes. Default is an empty array.

settings_checkbox()

Renders and initializes one or more checkbox type inputs based on the $field array.

protected function settings_checkbox( $field, $echo = true ) {}
  • $field array

    The array containing the field properties.

  • $echo boolean

    Default is true. Indicates whether the field markup should be echoed to the page.

checkbox_item()

Returns the markup for an individual checkbox item for the given choice array.

protected function checkbox_item( $choice, $horizontal_class, $attributes, $value, $tooltip, $error_icon='' ) {}
  • $choice array

    The array containing the choice properties.

  • $horizontal_class string

    The CSS class to style the checkbox items horizontally.

  • $attributes string

    The attributes to be added to the input element.

  • $value string

    Indicates if the current choice is selected (1 if field has been checked. 0 or null otherwise).

  • $tooltip string

    The tooltip for this choice.

checkbox_input()

Returns the markup for an individual checkbox input and label for the given choice array.

protected function checkbox_input( $choice, $attributes, $value, $tooltip ) {}
  • $choice array

    The array containing the choice properties.

  • $attributes string

    The attributes to be added to the input element.

  • $value string

    Indicates if the current choice is selected (1 if field has been checked. 0 or null otherwise).

  • $tooltip string

    The tooltip for this choice.

checkbox_input_{$choice_name}()

Define a custom checkbox_input_ function ending with a specific choice name to return a custom checkbox input and label markup for that choice.

public function checkbox_input_{$choice_name}( $choice, $attributes, $value, $tooltip ) {}
  • $choice array

    The array containing the choice properties.

  • $attributes string

    The attributes to be added to the input element.

  • $value string

    Indicates if the current choice is selected (1 if field has been checked. 0 or null otherwise).

  • $tooltip string

    The tooltip for this choice.

settings_select()

Renders and initializes a drop down field based on the $field array.

protected function settings_select( $field, $echo = true ) {}
  • $field array

    The array containing the field properties.

  • $echo boolean

    Default is true. Indicates whether the field markup should be echoed to the page.

get_select_options()

Prepares an HTML string of options for a drop down field.

public function get_select_options( $choices, $selected_value ) {}
  • $choices array

    The array containing the field choices.

  • $selected_value string

    The value currently selected for the field.

get_select_option()

Prepares an HTML string for a single drop down field option.

public function get_select_option( $choice, $selected_value ) {}
  • $choice array

    The array containing the choice properties.

  • $selected_value string

    The value currently selected for the field.

settings_select_custom()

Renders and initializes a drop down field with a input field for custom input based on the $field array.

protected function settings_select_custom( $field, $echo = true ) {}
  • $field array

    The array containing the field properties.

  • $echo boolean

    Default is true. Indicates whether the field markup should be echoed to the page.

settings_field_map()

Returns the field markup.

public function settings_field_map( $field, $echo = true ) {}
  • $field array

    The array containing the parent fields properties.

  • $echo boolean

    Default is true. Indicates whether the field markup should be echoed to the page.

field_map_table_header()

Returns the thead element with the column headers.

public function field_map_table_header() {}

field_map_title()

Returns the title to be displayed in the left column of the table, the column containing the labels of the child fields. Defaults to Field; override this function to return a custom title.

protected function field_map_title() {}

get_mapped_field_name()

Returns the key for this field as used in the meta property of the Feed Object. e.g. contactStandardFields_first_name

public function get_mapped_field_name( $parent_field, $field_name ) {}
  • $parent_field array

    The array containing the parent fields properties.

  • $field_name string

    The name property of the field_map child field.

settings_field_map_select()

Returns the markup for the drop down containing the form fields and entry meta choices.

public function settings_field_map_select( $field, $form_id ) {}
  • $field array

    The array containing the child field properties.

  • $form_id integer

    The ID of the current form.

get_field_map_choices()

Returns an array of form field and entry meta choices.

public static function get_field_map_choices( $form_id, $field_type = null, $exclude_field_types = null ) {}
  • $form_id integer

    The ID of the current form.

  • $field_type string|array

    The type of fields to be included.

  • $exclude_field_types string|array

    The type of fields to be excluded.

settings_field_select()

Renders a drop down field containing the form fields as choices.

protected function settings_field_select( $field, $echo = true ) {}
  • $field array

    The array containing the field properties.

  • $echo boolean

    Default is true. Indicates whether the field markup should be echoed to the page.

get_form_fields_as_choices()

Retrieve an array of choices containing the form fields.

public function get_form_fields_as_choices( $form, $args = array() ) {}
  • $form

    The current form.

  • $args array

    Additional settings to check for (field and input types to include, callback for applicable input type).

settings_checkbox_and_select()

Renders and initializes a checkbox field that displays a select field when checked.

protected function settings_select( $field, $echo = true ) {}
  • $field array

    The array containing the field properties.

  • $echo boolean

    Default is true. Indicates whether the field markup should be echoed to the page.

settings_dynamic_field_map()

Returns the field markup for the dynamic_field_map type field.

public function settings_dynamic_field_map( $field, $echo = true ) {}
  • $field array

    The array containing the parent fields properties.

  • $echo boolean

    Default is true. Indicates whether the field markup should be echoed to the page.

settings_save()

Returns the markup for the save button.

public function settings_save( $field, $echo = true ) {}
  • $field array

    The array containing the parent fields properties.

  • $echo boolean

    Default is true. Indicates whether the field markup should be echoed to the page.