Class GFAddOn
Class GFAddOn
Handles all tasks mostly common to any Gravity Forms Add-On, including third party ones.
Direct known subclasses
GFFeedAddOnIndirect known subclasses
GFPaymentAddOn
public
|
|
public static
|
|
public static
array
|
|
public static
|
|
public
|
|
public
|
|
public
|
#
init_admin( )
Override this function to add initialization code (i.e. hooks) for the admin site (WP dashboard) |
public
|
#
init_frontend( )
Override this function to add initialization code (i.e. hooks) for the public (customer facing) site |
public
|
|
public
array
|
#
minimum_requirements( )
Override this function to provide a list of requirements needed to use Add-On. |
public
boolean|array
|
#
meets_minimum_requirements( )
Performs a check to see if WordPress environment meets minimum requirements need to use Add-On. |
public
|
|
public
|
|
public
|
|
public
|
#
post_gravityforms_upgrade( mixed $db_version, mixed $previous_db_version, mixed $force_upgrade )
Gets called when Gravity Forms upgrade process is completed. This function is intended to be used internally, override the upgrade() function to execute database update scripts. |
public
|
|
public
|
|
public
array
|
#
get_entry_meta( array $entry_meta, integer $form_id )
Override this method to activate and configure entry meta. |
public
|
#
get_results_page_config( )
Returns the configuration for the results page. By default this is not activated. To activate the results page override this function and return an array with the configuration data. |
public
|
#
results_page_init( mixed $results_page_config )
Initializes the result page functionality. To activate result page functionality, override the get_results_page_config() function. |
public
|
|
public
|
#
members_register_cap_group( )
Register the Gravity Forms Add-Ons capabilities group with the Members plugin. |
public
|
#
members_register_caps( )
Register the Add-On capabilities and their human readable labels with the Members plugin. |
public
array
|
|
public static
array
|
#
filter_ure_capabilities_groups_tree( array $groups = array() )
Register Gravity Forms Add-Ons capabilities group with User Role Editor plugin. |
public
array
|
#
filter_ure_custom_capability_groups( array $groups = array(), string $cap_id = '' )
Register Gravity Forms capabilities with Gravity Forms group in User Role Editor plugin. |
public
boolean
|
#
current_user_can_any( string|array $caps )
Checks whether the current user is assigned to a capability or role. |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
#
single_setting_label( mixed $field )
Displays the label for a field, including the tooltip and requirement indicator. |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public static
|
|
public static
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
string
|
#
checkbox_item( mixed $choice, mixed $horizontal_class, mixed $attributes, mixed $value, mixed $tooltip, mixed $error_icon = '' )
Returns the markup for an individual checkbox item give the parameters |
public
string
|
#
checkbox_input( mixed $choice, mixed $attributes, mixed $value, mixed $tooltip )
Returns the markup for an individual checkbox input and its associated label |
public
|
|
public
boolean
|
#
choices_have_icon( array $choices = array() )
Determines if any of the available settings choices have an icon. |
public
|
|
public
string
|
#
settings_select_custom( array $field, boolean $echo = true )
Renders and initializes a drop down field with a input field for custom input based on the $field array. |
public
string
|
#
get_select_options( array $choices, string $selected_value )
Prepares an HTML string of options for a drop down field. |
public
string
|
#
get_select_option( array $choice, string $selected_value )
Prepares an HTML string for a single drop down field option. |
public
string
|
#
settings_generic_map( array $field, boolean $echo = true )
Renders and initializes a generic map field based on the $field array whose choices are populated by the fields to be mapped. |
public
string
|
#
settings_field_map( array $field, boolean $echo = true )
Renders and initializes a field map field based on the $field array whose choices are populated by the fields to be mapped. |
public
string
|
#
settings_dynamic_field_map( array $field, boolean $echo = true )
Renders and initializes a dynamic field map field based on the $field array whose choices are populated by the fields to be mapped. |
public
string
|
#
settings_field_map_select( array $field, integer $form_id )
Renders a field select field for field maps. |
public
string
|
#
get_mapping_field( string $type, array $select_field, array $text_field )
Prepares the markup for mapping field key and value fields. |
public
string
|
|
public
string
|
|
public static
array
|
#
get_field_map_choices( integer $form_id, array|string $field_type = null, array|string $exclude_field_types = null )
Get field map choices for specific form. |
public
string
|
#
get_mapped_field_name( array $parent_field, string $field_name )
Get input name for field map field. |
public static
array
|
#
get_field_map_fields( array $feed, string $field_name )
Get mapped key/value pairs for standard field map. |
public static
array
|
#
get_dynamic_field_map_fields( array $feed, string $field_name )
Get mapped key/value pairs for dynamic field map. |
public
array
|
#
get_generic_map_fields( array $feed, string $field_name, array $form = array(), array $entry = array() )
Get mapped key/value pairs for generic map. |
public
string
|
#
settings_field_select( array $field, boolean $echo = true )
Renders and initializes a drop down field based on the $field array whose choices are populated by the form's fields. |
public
|
|
public
string|null
|
#
get_default_field_select_field( array $field )
Returns the field to be selected by default for field select fields based on matching labels. |
public
array
|
#
get_form_fields_as_choices( array $form, array $args = array() )
Retrieve an array of form fields formatted for select, radio and checkbox settings fields. |
public
string
|
#
settings_checkbox_and_select( array $field, boolean $echo = true )
Renders and initializes a checkbox field that displays a select field when checked based on the $field array. |
public
|
|
public
|
|
public
array
|
#
get_field_attributes( array $field, array $default = array() )
Parses the properties of the $field meta array and returns a set of HTML attributes to be added to the HTML element. |
public
array
|
#
get_choice_attributes( array $choice, array $field_attributes, mixed $default_choice_attributes = array() )
Parses the properties of the $choice meta array and returns a set of HTML attributes to be added to the HTML element. |
public
|
|
public
boolean
|
#
validate_settings( mixed $fields, mixed $settings )
Validates settings fields. Validates that all fields are valid. Fields can be invalid when they are blank and marked as required or if it fails a custom validation check. To specify a custom validation, use the 'validation_callback' field meta property and implement the validation function with the custom logic. |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
boolean
|
#
is_choice_valid( array $choice, string|array $value )
Helper to determine if the current choice is a match for the submitted field value. |
public
|
#
set_field_error( array $field, string $error_message = '' )
Sets the validation error message Sets the error message to be displayed when a field fails validation. When implementing a custom validation callback function, use this function to specify the error message to be displayed. |
public
mixed
|
#
get_field_errors( array|boolean $field = false )
Gets the validation errors for a field. Returns validation errors associated with the specified field or a list of all validation messages (if a field isn't specified) |
public
string
|
#
get_error_icon( array $field )
Gets the invalid field icon Returns the markup for an alert icon to indicate and highlight invalid fields. |
public
string
|
#
maybe_get_tooltip( array $item )
Returns the tooltip markup if a tooltip is configured for the supplied item (field/child field/choice). |
public
string
|
#
get_required_indicator( mixed $field )
Gets the required indicator Gets the markup of the required indicator symbol to highlight fields that are required |
public
boolean|mixed
|
|
public
mixed
|
#
filter_settings( mixed $fields, mixed $settings )
Filter settings fields. Runs through each field and applies the 'save_callback', if set, before saving the settings. To specify a custom save filter, use the 'save_callback' field meta property and implement the save filter function with the custom logic. |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
string
|
#
simple_condition( mixed $setting_name_root )
Helper to create a simple conditional logic set of fields. It creates one row of conditional logic with Field/Operator/Value inputs. |
public
array
|
#
get_conditional_logic_fields( )
Override this to define the array of choices which should be used to populate the Simple Condition fields drop down. |
public
boolean
|
#
is_simple_condition_met( string $setting_name_root, array $form, array $entry, array $feed = array() )
Evaluate the rules defined for the Simple Condition field. |
public
|
#
form_settings_init( )
Initializes form settings page Hooks up the required scripts and actions for the Form Settings page |
public
|
#
plugin_page_init( )
Initializes plugin settings page Hooks up the required scripts and actions for the Plugin Settings page |
public
array
|
#
create_plugin_page_menu( mixed $menus )
Creates plugin page menu item Target of gform_addon_navigation filter. Creates a menu item in the left nav, linking to the plugin page |
public
|
|
public
|
|
public
|
#
form_settings( mixed $form )
Custom form settings page Override this function to implement a complete custom form settings page. Before overriding this function, consider using the form_settings_fields() and specifying your field meta. |
public
|
#
form_settings_page_title( )
Custom form settings title Override this function to display a custom title on the Form Settings Page. By default, the first section in the configuration done in form_settings_fields() will be used as the page title. Use this function to override that behavior and add a custom page title. |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
#
plugin_page_container( )
Plugin page container Target of the plugin menu left nav icon. Displays the outer plugin page markup and calls plugin_page() to render the actual page. Override plugin_page() in order to provide a custom plugin page |
public
boolean
|
|
public
|
#
create_app_menu( )
Creates a top level app menu. Adds the app settings page automatically if it's configured. Target of the WordPress admin_menu action. Not intended to be overridden or called directly by add-ons. |
public
array
|
|
public
string
|
#
get_app_menu_icon( )
Override this function to specify a custom icon for the top level app menu. Accepts a dashicon class or a URL. |
public
|
|
public
|
|
public
array
|
|
public
array
|
|
public
|
#
form_settings_fields( mixed $form )
Override this function to specify the settings fields to be rendered on the form settings page |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
boolean
|
|
public
mixed
|
|
public
mixed
|
#
get_plugin_setting( string $setting_name )
Get plugin setting Returns the plugin setting specified by the $setting_name parameter |
public
|
|
public
|
|
public
array
|
#
plugin_settings_fields( )
Override this function to specify the settings fields to be rendered on the plugin settings page |
public
array|mixed|
|
|
public
|
|
public
|
#
app_tab_page_header( mixed $tabs, mixed $current_tab, mixed $title, string $message = '' )
Renders the header for the tabs UI. |
public
|
|
public
|
|
public
string
|
|
public
string
|
|
public
boolean
|
|
public
|
|
public
mixed
|
|
public
mixed
|
#
get_app_setting( string $setting_name )
Get app setting Returns the app setting specified by the $setting_name parameter |
public
|
|
public
|
|
public
array
|
#
app_settings_fields( )
Override this function to specify the settings fields to be rendered on the plugin settings page |
public
array
|
#
settings_fields_only( string $settings_type = 'plugin' )
Returns an flattened array of field settings for the specified settings type ignoring sections. |
public
|
#
render_uninstall( )
Override this function to customize the markup for the uninstall section on the plugin settings page |
public
|
|
public
|
|
public
|
|
public
|
#
plugin_message( )
Returns the message that will be displayed if the current version of Gravity Forms is not supported. |
public
|
|
public
|
#
is_locking_edit_page( )
Returns TRUE if the current page is the edit page. Otherwise, returns FALSE |
public
|
#
is_locking_list_page( )
Returns TRUE if the current page is the list page. Otherwise, returns FALSE |
public
|
#
is_locking_view_page( )
Returns TRUE if the current page is the view page. Otherwise, returns FALSE |
public
|
|
public
string
|
|
public
string
|
#
list_row_class( integer $object_id, boolean $echo = true )
Outputs class for the row for the specified Object ID on the list page. |
public
boolean
|
|
public
string
|
#
get_mapped_field_value( string $setting_name, array $form, array $entry, mixed $settings = false )
Returns the value of the mapped field. |
public
string
|
#
get_field_value( array $form, array $entry, string $field_id )
Returns the value of the selected field. |
public
string
|
#
maybe_override_field_value( string $field_value, array $form, array $entry, string $field_id )
Enables use of the gform_SLUG_field_value filter to override the field value. Override this function to prevent the filter being used or to implement a custom filter. |
public
string
|
#
get_full_address( array $entry, string $field_id )
Returns the combined value of the specified Address field. |
public
string
|
#
get_full_name( array $entry, string $field_id )
Returns the combined value of the specified Name field. |
public
string
|
#
get_list_field_value( array $entry, string $field_id, GF_Field_List $field )
Returns the value of the specified List field. |
public
string
|
#
get_first_field_by_type( string $field_type, integer $subfield_id = null, integer $form_id = null, mixed $return_first_only = true )
Returns the field ID of the first field of the desired type. |
public
string
|
#
note_avatar( )
Override this function to specify a custom avatar (i.e. the payment gateway logo) for entry notes created by the Add-On |
public
|
|
public
|
|
final protected
|
|
public
string
|
|
final public static
string
|
|
final public static
string
|
|
public
string
|
|
public
boolean
|
|
public
|
|
public
boolean|mixed
|
#
is_gravityforms_supported( mixed $min_gravityforms_version = '' )
Checks whether the current version of Gravity Forms is supported |
public
|
#
get_short_title( )
Returns this plugin's short title. Used to display the plugin title in small areas such as tabs |
public
string
|
|
public
|
#
get_plugin_settings_url( )
Returns the unescaped URL for the plugin settings tab associated with this plugin |
public
|
#
get_current_form( )
Returns the current form object based on the id query var. Otherwise returns false |
public
|
|
public
|
|
public
|
#
is_form_editor( )
Returns TRUE if the current page is the form editor page. Otherwise, returns FALSE |
public
|
|
public
boolean
|
#
is_form_settings( string $tab = null )
Returns TRUE if the current page is the form settings page, or a specific form settings tab (specified by the $tab parameter). Otherwise returns FALSE |
public
boolean
|
#
is_plugin_settings( string $tab = '' )
Returns TRUE if the current page is the plugin settings main page, or a specific plugin settings tab (specified by the $tab parameter). Otherwise returns FALSE |
public
boolean
|
#
is_app_settings( string $tab = '' )
Returns TRUE if the current page is the app settings main page, or a specific apps settings tab (specified by the $tab parameter). Otherwise returns FALSE |
public
boolean
|
|
public
boolean
|
#
is_entry_view( )
Returns TRUE if the current page is the entry view page. Otherwise, returns FALSE |
public
boolean
|
#
is_entry_edit( )
Returns TRUE if the current page is the entry edit page. Otherwise, returns FALSE |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public static
|
|
public static
|
#
get_deprecated_protected_methods_for_base_class( mixed $base_class_name, mixed $add_on_class_name = '' )
|
public
|
|
public
|
|
public
|
|
public
string|array
|
|
public
|
|
public
|
protected
string
|
$_version
Version number of the Add-On |
|
protected
string
|
$_min_gravityforms_version
Gravity Forms minimum version requirement |
|
protected
string
|
$_slug
URL-friendly identifier used for form settings, add-on settings, text domain localization... |
|
protected
string
|
$_path
Relative path to the plugin from the plugins folder. Example "gravityforms/gravityforms.php" |
|
protected
string
|
$_full_path
Full path the the plugin. Example: __FILE__ |
|
protected
string
|
$_url
URL to the Gravity Forms website. Example: 'http://www.gravityforms.com' OR affiliate link. |
|
protected
string
|
$_title
Title of the plugin to be used on the settings page, form settings and plugins page. Example: 'Gravity Forms MailChimp Add-On' |
|
protected
string
|
$_short_title
Short version of the plugin title to be used on menus and other places where a less verbose string is useful. Example: 'MailChimp' |
|
protected
array
|
$_capabilities
Members plugin integration. List of capabilities to add to roles. |
# array() |
public
string
|
$app_hook_suffix
The hook suffix for the app menu |
|
protected
string|array
|
$_capabilities_settings_page
A string or an array of capabilities or roles that have access to the settings page |
# array() |
protected
string|array
|
$_capabilities_form_settings
A string or an array of capabilities or roles that have access to the form settings |
# array() |
protected
string|array
|
$_capabilities_plugin_page
A string or an array of capabilities or roles that have access to the plugin page |
# array() |
protected
string|array
|
$_capabilities_app_menu
A string or an array of capabilities or roles that have access to the app menu |
# array() |
protected
string|array
|
$_capabilities_app_settings
A string or an array of capabilities or roles that have access to the app settings page |
# array() |
protected
string|array
|
$_capabilities_uninstall
A string or an array of capabilities or roles that can uninstall the plugin |
# array() |