Skip to main content

GravityView_Admin_Views

Source: includes/class-admin-views.php:27

Details

  • Kind: class
  • Namespace: (global)

Methods

MethodDescription
get_instance()Returns the singleton.
disable_views_overview_notices()Disables all notices and footer text on the Views overview page.
is_views_overview_page()Checks if the current page is the Views overview page.
suggest_support_articles()When on the Add/Edit View screen, suggest most popular articles related to that
filter_pre_get_posts()
add_view_dropdown()Adds dropdown selects to filter Views by connected form and layout
render_setting_row()
render_field_option()
gform_toolbar_menu()Add a GravityView menu to the Form Toolbar with connected views
default_field_blocklist()List the field types without presentation properties (on a View context)
default_field_blacklist()
tooltips()Add tooltip text for use throughout the UI
add_custom_column_content()Add the Data Source information
get_connected_form_links()Get HTML links relating to a connected form, like Edit, Entries, Settings, Preview
add_post_type_columns()Add the Data Source column to the Views page
save_postdata()Save View configuration
render_label()
render_available_fields()Render html for displaying available fields based on a Form ID
render_additional_fields()Render html for displaying additional fields based on a Form ID
get_entry_default_fields()Retrieve the default fields id, label and type
get_available_fields()Calculate the available fields
render_available_widgets()Render html for displaying available widgets
get_registered_widgets()Get the list of registered widgets. Each item is used to instantiate a GravityView_Admin_View_Widget object
render_active_areas()Generic function to render rows and columns of active areas for widgets & fields
render_actions()Renders the row actions.
render_widgets_active_areas()Render the widget active areas
render_field_pickers()Renders "Add Field" tooltips
render_directory_active_areas()Render the Template Active Areas and configured active fields for a given template id and post id
render_add_row()Returns an "add row" button for a template zone.
set_dynamic_areas()Returns whether the widgets should be dynamic; based on the plugin setting.
add_scripts_and_styles()Enqueue scripts and styles at Views editor
enqueue_gravity_forms_scripts()Enqueue Gravity Forms scripts, needed for Merge Tags
register_no_conflict()Add GravityView scripts and styles to Gravity Forms and GravityView No-Conflict modes
add_clear_all_fields_action()Renders a "Clear all fields" button in the View configuration.

Method Reference

get_instance()

public static function get_instance(): self

Returns the singleton.

Returns

  • self

Since: 2.42

Source: includes/class-admin-views.php:44

disable_views_overview_notices()

public function disable_views_overview_notices()

Disables all notices and footer text on the Views overview page.

Returns

  • void

Since: 2.33

Source: includes/class-admin-views.php:110

is_views_overview_page()

public function is_views_overview_page(): bool

Checks if the current page is the Views overview page.

Returns

  • bool

Since: 2.33

Source: includes/class-admin-views.php:141

suggest_support_articles()

function suggest_support_articles( $localization_data=[] )

When on the Add/Edit View screen, suggest most popular articles related to that

Parameters

NameTypeDefaultDescription
$localization_dataarray[]Data to be passed to the Support Port JS

Returns

  • array

Source: includes/class-admin-views.php:182

filter_pre_get_posts()

public function filter_pre_get_posts( &$query )

Parameters

NameTypeDefaultDescription
&$queryWP_Query

Since: 1.15

Source: includes/class-admin-views.php:206

add_view_dropdown()

public function add_view_dropdown()

Adds dropdown selects to filter Views by connected form and layout

Returns

  • void

Source: includes/class-admin-views.php:253

render_setting_row()

public static function render_setting_row( $key='', $current_settings=[], $override_input=null, $name='template_settings[%s]', $id='gravityview_se_%s' )

Parameters

NameTypeDefaultDescription
$key''
$current_settings[]
$override_inputnull
$name'template_settings[%s]'
$id'gravityview_se_%s'

Deprecated: since 1.2 Start using GravityView_Render_Settings::render_setting_row

Source: includes/class-admin-views.php:326

render_field_option()

public static function render_field_option( $name='', $option=[], $curr_value=null )

Parameters

NameTypeDefaultDescription
$name''
$option[]
$curr_valuenull

Deprecated: since 1.2 Start using GravityView_Render_Settings::render_field_option

Source: includes/class-admin-views.php:343

gform_toolbar_menu()

public static function gform_toolbar_menu( $menu_items=[], $id=null )

Add a GravityView menu to the Form Toolbar with connected views

Parameters

NameTypeDefaultDescription
$menu_itemsarray[]Menu items, as set in GFForms::top_toolbar()
$idintnullID of the current Gravity form

Returns

  • array — Modified array

Source: includes/class-admin-views.php:359

default_field_blocklist()

public function default_field_blocklist( $array=[], $context=null )

List the field types without presentation properties (on a View context)

Parameters

NameTypeDefaultDescription
$arrayarray[]Existing field types to add to a blocklist
$contextstring | nullnullContext for the blocklist. Default: NULL.

Returns

  • array — Default blocklist fields merged with existing blocklist fields

Since: 2.14

Source: includes/class-admin-views.php:448

default_field_blacklist()

public function default_field_blacklist( $array, $context )

Parameters

NameTypeDefaultDescription
$array
$context

Deprecated: 2.14

Source: includes/class-admin-views.php:464

tooltips()

public function tooltips( $tooltips=[] )

Add tooltip text for use throughout the UI

Parameters

NameTypeDefaultDescription
$tooltipsarray[]Array of Gravity Forms tooltips

Returns

  • array — Modified tooltips array

Source: includes/class-admin-views.php:476

add_custom_column_content()

public function add_custom_column_content( $column_name=null, $post_id=0 )

Add the Data Source information

Parameters

NameTypeDefaultDescription
$column_namenullnullName of the column in the Views table.
$post_idint0Post ID.

Returns

  • void

Source: includes/class-admin-views.php:547

public static function get_connected_form_links( $form, $include_form_link=true )

Get HTML links relating to a connected form, like Edit, Entries, Settings, Preview

Parameters

NameTypeDefaultDescription
$formarray | intGravity Forms forms array, or the form ID
$include_form_linkbooleantrueWhether to include the bold name of the form in the output

Returns

  • string — HTML links

Source: includes/class-admin-views.php:637

add_post_type_columns()

public function add_post_type_columns( $columns )

Add the Data Source column to the Views page

Parameters

NameTypeDefaultDescription
$columnsarrayColumns array

Source: includes/class-admin-views.php:723

save_postdata()

function save_postdata( $post_id )

Save View configuration

Parameters

NameTypeDefaultDescription
$post_idintCurrently saved Post ID

Returns

  • void

Source: includes/class-admin-views.php:762

render_label()

function render_label()

Deprecated: 1.1.6

Source: includes/class-admin-views.php:874

render_available_fields()

function render_available_fields( $form_id=0, $context='single' )

Render html for displaying available fields based on a Form ID

Parameters

NameTypeDefaultDescription
$form_idint | string0Gravity Forms form ID. Default: 0.
$contextstring'single'(default: 'single')

Returns

  • void

See Also

Source: includes/class-admin-views.php:890

render_additional_fields()

public function render_additional_fields( $form_id=0, $context='single' )

Render html for displaying additional fields based on a Form ID

Parameters

NameTypeDefaultDescription
$form_idint | string0Gravity Forms form ID. Default: 0.
$contextstring'single'(default: 'single')

Returns

  • void

Source: includes/class-admin-views.php:961

get_entry_default_fields()

function get_entry_default_fields( $form, $zone )

Retrieve the default fields id, label and type

Parameters

NameTypeDefaultDescription
$formstring | arrayform_ID or form object
$zonestringEither 'single', 'directory', 'header', 'footer'

Returns

  • array

Source: includes/class-admin-views.php:1025

get_available_fields()

function get_available_fields( $form='', $zone=null )

Calculate the available fields

Parameters

NameTypeDefaultDescription
$formstring | array''form_ID or form object
$zonestringnullEither 'single', 'directory', 'header', 'footer'

Returns

  • array — fields

Source: includes/class-admin-views.php:1059

render_available_widgets()

function render_available_widgets()

Render html for displaying available widgets

Returns

  • void

Source: includes/class-admin-views.php:1118

get_registered_widgets()

function get_registered_widgets()

Get the list of registered widgets. Each item is used to instantiate a GravityView_Admin_View_Widget object

Returns

  • array

Since: 1.13.1

Deprecated: Use \GV\Widget::registered()

Source: includes/class-admin-views.php:1137

render_active_areas()

function render_active_areas( $template_id, $type, $zone, $rows, $values )

Generic function to render rows and columns of active areas for widgets & fields

Parameters

NameTypeDefaultDescription
$template_idstringThe current slug of the selected View template
$typestringEither 'widget' or 'field'
$zonestringEither 'single', 'directory', 'edit', 'header', 'footer'
$rowsarrayThe layout structure: rows, columns and areas
$valuesarraySaved objects

Returns

  • void

Source: includes/class-admin-views.php:1154

render_actions()

public function render_actions( bool $is_dynamic, string $template_id, string $type, string $zone ): void

Renders the row actions.

Parameters

NameTypeDefaultDescription
$is_dynamicboolWhether the rows are actionable.
$template_idstring
$typestring
$zonestring

Returns

  • void

Since: 2.31.0

Source: includes/class-admin-views.php:1422

render_widgets_active_areas()

function render_widgets_active_areas( $template_id='', $zone='', $post_id='' )

Render the widget active areas

Parameters

NameTypeDefaultDescription
$template_idstring''The current slug of the selected View template
$zonestring''Either 'header' or 'footer'
$post_idstring''Current Post ID (view)

Returns

  • string — html

Source: includes/class-admin-views.php:1478

render_field_pickers()

function render_field_pickers( $context='directory', $form_ids=[] )

Renders "Add Field" tooltips

Parameters

NameTypeDefaultDescription
$contextstring'directory'"directory", "single", "edit" or "search".
$form_idsarray[](default: array) Array of form IDs.

Returns

  • void

Since: 2.0.11

Source: includes/class-admin-views.php:1581

render_directory_active_areas()

function render_directory_active_areas( $template_id='', $context='single', $post_id=0, $echo=false, $form_id=0 )

Render the Template Active Areas and configured active fields for a given template id and post id

Parameters

NameTypeDefaultDescription
$template_idstring''(default: '') Template ID, like default_list, default_table, preset_business_data, etc. \GravityView_Template::__construct()
$contextstring'single'(default: 'single') Context of the template. single or directory (edit not implemented but valid).
$post_idstring0(default: '') ID of the View CPT. Used to get the fields for the View.
$echoboolfalse(default: false) Whether to echo the output or return it. Default: false.
$form_idint0(default: 0) Main form ID for the View. Used to set default fields for a new View.

Returns

  • string — HTML of the active areas

Source: includes/class-admin-views.php:1644

render_add_row()

public function render_add_row( string $template_id, string $type, string $zone, bool $is_dynamic ): void

Returns an "add row" button for a template zone.

Parameters

NameTypeDefaultDescription
$template_idstringThe template ID.
$typestringThe object type (widget or field).)
$zonestringThe zone ID.
$is_dynamicboolWhether the zone is dynamic.

Returns

  • void

Since: 2.31.0

Source: includes/class-admin-views.php:1755

set_dynamic_areas()

public function set_dynamic_areas( bool $is_dynamic, string $_, string $type, string $zone ): bool

Returns whether the widgets should be dynamic; based on the plugin setting.

Parameters

NameTypeDefaultDescription
$is_dynamicboolWhether the zone is dynamic.
$_stringThe template ID (unused))
$typestringThe object type (widget or field).
$zonestring

Returns

  • bool — Whether the widgets should be dynamic.

Since: 2.31.0

Source: includes/class-admin-views.php:1834

add_scripts_and_styles()

static function add_scripts_and_styles( $hook )

Enqueue scripts and styles at Views editor

Parameters

NameTypeDefaultDescription
$hookmixed

Returns

  • void

Source: includes/class-admin-views.php:1950

enqueue_gravity_forms_scripts()

static function enqueue_gravity_forms_scripts()

Enqueue Gravity Forms scripts, needed for Merge Tags

Returns

  • void

Since: 1.0.5-beta

Source: includes/class-admin-views.php:2104

register_no_conflict()

function register_no_conflict( $registered )

Add GravityView scripts and styles to Gravity Forms and GravityView No-Conflict modes

Parameters

NameTypeDefaultDescription
$registeredarrayExisting scripts or styles that have been registered (array of the handles)

Returns

  • array

Source: includes/class-admin-views.php:2135

add_clear_all_fields_action()

public function add_clear_all_fields_action( $area, $type, $values, $is_dynamic, $template_id, $zone ): void

Renders a "Clear all fields" button in the View configuration.

Parameters

NameTypeDefaultDescription
$areaarrayThe area.
$typestringThe type.
$values
$is_dynamicboolWhether the zone is dynamic.
$template_idstringThe template ID.
$zonestringThe zone.

Returns

  • void

Since: 2.44

Source: includes/class-admin-views.php:2191