GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
Public Member Functions | Static Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes | Private Attributes
Widget Class Reference

If this file is called directly, abort. More...

Inheritance diagram for Widget:
GravityView_Widget GravityView_Widget_Custom_Content GravityView_Widget_Gravity_Forms GravityView_Widget_Page_Links GravityView_Widget_Pagination_Info GravityView_Widget_Search Page_Size GravityView_Widget_Custom_Content GravityView_Widget_Page_Links GravityView_Widget_Pagination_Info GravityView_Widget_Poll GravityView_Widget_Poll

Public Member Functions

 add_shortcode ()
 Add $this->shortcode_name shortcode to output self::render_frontend() More...
 
 as_configuration ()
 Return an array of the old format. More...
 
 assign_widget_options ( $options=array(), $template='', $widget='')
 Assign template specific widget options. More...
 
 get_setting ( $key)
 Get a setting by the setting key. More...
 
 get_settings ()
 Get the widget settings. More...
 
 get_widget_id ()
 Get the Widget ID. More...
 
 is_registered ()
 Whether this Widget's been registered already or not. More...
 
 maybe_do_shortcode ( $text, $widget=null)
 Do shortcode if the Widget's shortcode exists. More...
 
 pre_render_frontend ()
 General validations when rendering the widget. More...
 
 register_widget ( $widgets)
 Register widget to become available in admin. More...
 
 render_frontend ( $widget_args, $content='', $context='')
 Frontend logic. More...
 
 render_shortcode ( $atts, $content='', $context='')
 Shortcode. More...
 

Static Public Member Functions

static from_configuration ( $configuration)
 Create the needed widget from a configuration array. More...
 
static get_default_widget_areas ()
 Default widget areas. More...
 
static registered ()
 Return all registered widgets. More...
 

Data Fields

 $configuration
 
 $icon
 
 $position = ''
 
 $UID = ''
 

Protected Member Functions

 get_default_settings ()
 Define general widget settings. More...
 

Protected Attributes

 $defaults = array()
 
 $settings = array()
 
 $shortcode_name
 
 $widget_description = ''
 
 $widget_id = ''
 
 $widget_label = ''
 
 $widget_subtitle = ''
 

Private Attributes

 $widget_options = array()
 

Detailed Description

If this file is called directly, abort.

The class.

An interface that most GravityView widgets would want to adhere to and inherit from.

Definition at line 14 of file class-gv-widget.php.

Member Function Documentation

◆ add_shortcode()

add_shortcode ( )

Add $this->shortcode_name shortcode to output self::render_frontend()

Returns
void

Definition at line 326 of file class-gv-widget.php.

References $post, and gravityview().

◆ as_configuration()

as_configuration ( )

Return an array of the old format.

'id' => string

  • whatever else specific fields may have

Definition at line 476 of file class-gv-widget.php.

◆ assign_widget_options()

assign_widget_options (   $options = array(),
  $template = '',
  $widget = '' 
)

Assign template specific widget options.

protected

Parameters
array$options(default: array())
string$template(default: '')
Returns
array

Definition at line 297 of file class-gv-widget.php.

References $settings.

◆ from_configuration()

static from_configuration (   $configuration)
static

Create the needed widget from a configuration array.

Parameters
array$configurationThe configuration array.
See also
::as_configuration()

Definition at line 444 of file class-gv-widget.php.

References $class.

◆ get_default_settings()

get_default_settings ( )
protected

Define general widget settings.

Since
1.5.4
Returns
array $settings Default settings
Runs Filter:
gravityview/widget/enable_custom_class Enable custom CSS class settings for widgets
Parameters
boolean$enable_custom_classFalse by default. Return true if you want to enable.
\GV\Widget$thisCurrent instance of .

Definition at line 157 of file class-gv-widget.php.

References $settings.

◆ get_default_widget_areas()

static get_default_widget_areas ( )
static

Default widget areas.

Usually overridden by the selected template.

Returns
array The default areas where widgets can be rendered.
Runs Filter:
gravityview_widget_active_areas Array of zones available for widgets to be dropped into
Parameters
array$default_areasDefinition for default widget areas
Runs Filter:
gravityview/widget/active_areas Array of zones available for widgets to be dropped into
Since
2.0
Parameters
array$default_areasDefinition for default widget areas

Definition at line 219 of file class-gv-widget.php.

Referenced by GravityView_Ajax\get_preset_fields_config(), GravityView_View\render_widget_hooks(), and GravityView_Admin_Views\render_widgets_active_areas().

◆ get_setting()

get_setting (   $key)

Get a setting by the setting key.

Parameters
string$keyKey for the setting
Returns
mixed|null Value of the setting; NULL if not set

Definition at line 208 of file class-gv-widget.php.

◆ get_settings()

get_settings ( )

Get the widget settings.

Returns
array|null Settings array; NULL if not set for some reason.

Definition at line 195 of file class-gv-widget.php.

References $settings.

◆ get_widget_id()

get_widget_id ( )

Get the Widget ID.

Returns
string The Widget ID.

Definition at line 186 of file class-gv-widget.php.

◆ is_registered()

is_registered ( )

Whether this Widget's been registered already or not.

Since
2.0
Returns
bool

Definition at line 513 of file class-gv-widget.php.

References gravityview().

Referenced by Page_Size\__construct(), GravityView_Widget_Poll\__construct(), and GravityView_Widget_Search\__construct().

◆ maybe_do_shortcode()

maybe_do_shortcode (   $text,
  $widget = null 
)

Do shortcode if the Widget's shortcode exists.

Parameters
string$textWidget text to check
null|

Definition at line 314 of file class-gv-widget.php.

◆ pre_render_frontend()

pre_render_frontend ( )

General validations when rendering the widget.

Always call this from your render_frontend() override!

Returns
boolean True: render frontend; False: don't render frontend

Assume shown regardless of hide_until_search setting.

Runs Filter:
gravityview/widget/hide_until_searched/allowlist Some widgets have got to stay shown.
Since
2.14
Parameters
string[]$allowlist The widget IDs that have to be shown by default.
Runs Filter:
gravityview/widget/hide_until_searched Modify whether to hide content until search
Parameters
boolean$hide_until_searchedHide until search?
\GV\Widget$thisWidget instance

Definition at line 377 of file class-gv-widget.php.

References gravityview().

Referenced by GravityView_Widget_Page_Links\render_frontend(), GravityView_Widget_Pagination_Info\render_frontend(), GravityView_Widget_Custom_Content\render_frontend(), Page_Size\render_frontend(), and GravityView_Widget_Gravity_Forms\render_frontend().

◆ register_widget()

register_widget (   $widgets)

Register widget to become available in admin.

And for lookup.

Parameters
array$widgetsUsually just empty. Used to gather them all up.
Returns
array $widgets

Definition at line 271 of file class-gv-widget.php.

◆ registered()

static registered ( )
static

Return all registered widgets.

Since
2.0
Returns
array
Runs Filter:
gravityview_register_directory_widgets Get the list of registered widgets. Each item is used to instantiate a GravityView_Admin_View_Widget object
Parameters
array$registered_widgetsEmpty array
Runs Filter:
gravityview/widgets/register Each item is used to instantiate a GravityView_Admin_View_Widget object
Parameters
array$registered_widgetsEmpty array

Definition at line 490 of file class-gv-widget.php.

Referenced by GravityView_Admin_Views\render_active_areas(), and GravityView_Admin_Views\render_available_widgets().

◆ render_frontend()

render_frontend (   $widget_args,
  $content = '',
  $context = '' 
)

Frontend logic.

Override in child class.

Parameters
array$widget_argsThe Widget shortcode args.
string$contentThe content.
string | \GV\Template_Context$contextThe context, if available.
Returns
void

Definition at line 367 of file class-gv-widget.php.

◆ render_shortcode()

render_shortcode (   $atts,
  $content = '',
  $context = '' 
)

Shortcode.

Parameters
array$attsThe Widget shortcode args.
string$contentThe content.
string | \GV\Template_Context$contextThe context, if available.
Returns
string Whatever the widget echoed.

Definition at line 428 of file class-gv-widget.php.

References $content.

Field Documentation

◆ $configuration

$configuration

Definition at line 88 of file class-gv-widget.php.

◆ $defaults

$defaults = array()
protected

Definition at line 45 of file class-gv-widget.php.

◆ $icon

$icon

Definition at line 101 of file class-gv-widget.php.

◆ $position

$position = ''

Definition at line 71 of file class-gv-widget.php.

◆ $settings

$settings = array()
protected

◆ $shortcode_name

$shortcode_name
protected

Definition at line 57 of file class-gv-widget.php.

◆ $UID

$UID = ''

Definition at line 79 of file class-gv-widget.php.

◆ $widget_description

$widget_description = ''
protected

Definition at line 26 of file class-gv-widget.php.

◆ $widget_id

$widget_id = ''
protected

Definition at line 39 of file class-gv-widget.php.

◆ $widget_label

$widget_label = ''
protected

Definition at line 20 of file class-gv-widget.php.

◆ $widget_options

$widget_options = array()
private

Definition at line 63 of file class-gv-widget.php.

◆ $widget_subtitle

$widget_subtitle = ''
protected

Definition at line 33 of file class-gv-widget.php.


The documentation for this class was generated from the following file: