GravityView  2.1.1
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_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
 
 $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 285 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 425 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 256 of file class-gv-widget.php.

◆ 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 393 of file class-gv-widget.php.

References $class, and GV\get().

◆ 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 143 of file class-gv-widget.php.

◆ 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
Parameters
array$default_areasDefinition for default widget areas

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

Referenced by GravityView_Plugin\get_default_widget_areas(), 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 193 of file class-gv-widget.php.

References GV\get().

◆ get_settings()

get_settings ( )

Get the widget settings.

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

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

◆ get_widget_id()

get_widget_id ( )

Get the Widget ID.

Returns
string The Widget ID.

Definition at line 171 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 462 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|WP_WidgetEmpty if not called by WP_Widget, or a WP_Widget instance
Returns
string Widget text

Definition at line 273 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/whitelist Some widgets have got to stay shown.
Parameters
[in,out]string[]$whitelist 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 333 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(), and Page_Size\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 231 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 439 of file class-gv-widget.php.

◆ 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 323 of file class-gv-widget.php.

Referenced by GravityView_Widget_Search\has_date_field().

◆ render_shortcode()

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

Shortcode.

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

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

References $content.

Field Documentation

◆ $configuration

$configuration

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

◆ $defaults

$defaults = array()
protected

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

◆ $position

$position = ''

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

◆ $settings

$settings = array()
protected

◆ $shortcode_name

$shortcode_name
protected

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

◆ $UID

$UID = ''

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

◆ $widget_description

$widget_description = ''
protected

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

◆ $widget_id

$widget_id = ''
protected

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

◆ $widget_label

$widget_label = ''
protected

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

◆ $widget_options

$widget_options = array()
private

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

◆ $widget_subtitle

$widget_subtitle = ''
protected

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


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