GravityView  2.5
The best, easiest way to display Gravity Forms entries on your website.
Static Public Member Functions | Static Private Attributes
Legacy_Context Class Reference

A manager of legacy global states and contexts. More...

Static Public Member Functions

static freeze ()
 Serializes the current configuration as needed. More...
 
static load ( $configuration)
 Hydrates the legacy context globals as needed. More...
 
static pop ()
 Restores last saved state and context. More...
 
static push ( $configuration)
 Set the state depending on the provided configuration. More...
 
static reset ()
 Resets the global state completely. More...
 
static thaw ( $data)
 Unserializes a saved configuration. More...
 

Static Private Attributes

static $stack = array()
 

Detailed Description

A manager of legacy global states and contexts.

Handles mocking of:

Allows us to set a specific state globally using the old containers, then reset it. Useful for legacy code that keeps on depending on these variables.

Some examples right now include template files, utility functions, some actions and filters that expect the old contexts to be set.

Definition at line 357 of file _mocks.php.

Member Function Documentation

◆ freeze()

static freeze ( )
static

Serializes the current configuration as needed.

Returns
array The configuration.

Definition at line 419 of file _mocks.php.

References GravityView_frontend\getInstance(), GravityView_View_Data\getInstance(), and GravityView_View\getInstance().

◆ load()

static load (   $configuration)
static

Hydrates the legacy context globals as needed.

See also
self::push() for format.
Returns
void

{

Since
1.6}

Definition at line 552 of file _mocks.php.

References $gravityview_view, $value, GravityView_View_Data\getInstance(), GravityView_View\getInstance(), gravityview(), and Shortcode\parse().

Referenced by Field_Template\render(), View_Table_Template\the_entry(), View_List_Template\the_field(), and View_Table_Template\the_field().

◆ pop()

static pop ( )
static

Restores last saved state and context.

Returns
void

Definition at line 410 of file _mocks.php.

Referenced by Entry_Legacy_Template\render(), View_Legacy_Template\render(), View_Renderer\render(), and Edit_Entry_Renderer\render().

◆ push()

static push (   $configuration)
static

Set the state depending on the provided configuration.

Saves current global state and context.

Configuration keys:

  • view: sets ::atts, ::view_id, ::back_link_label ::context_view_id, ::form, ::form_id
  • field: sets ::_current_field, ::field_data,
  • entry: sets ::_current_entry, ::single_entry, ::entry
  • post: sets ::post_id, ::post_id, ::is_gravityview_post_type, ::post_has_shortcode
  • array paging: sets ::paging
  • array sorting: sets ::sorting
  • array template: sets ::template_part_slug, ::template_part_name
  • boolean in_the_loop sets $wp_actions['loop_start'] and $wp_query::in_the_loop

also:

  • request: sets ::is_search, ::single_entry, ::context, ::entry
  • views: sets ::views
  • fields: sets ::fields
  • entries: sets ::entries, ::total_entries

and automagically:

  • data: sets ::gv_output_data
Parameters
array$configurationThe configuration.
Returns
void

Definition at line 400 of file _mocks.php.

Referenced by Entry_Legacy_Template\render(), View_Legacy_Template\render(), View_Renderer\render(), Entry_Renderer\render(), Edit_Entry_Renderer\render(), and Legacy_Override_Template\render().

◆ reset()

static reset ( )
static

Resets the global state completely.

Use with utmost care, as filter and action callbacks may be added again.

Does not touch the context stack.

Returns
void

Definition at line 680 of file _mocks.php.

References $class, GravityView_View_Data\$instance, GravityView_frontend\$instance, GravityView_View\$instance, foreach, and gravityview().

◆ thaw()

static thaw (   $data)
static

Unserializes a saved configuration.

Modifies the global state.

Parameters
array$dataSaved configuration from self::freeze()

Definition at line 457 of file _mocks.php.

References $value, GravityView_frontend\getInstance(), GravityView_View_Data\getInstance(), and GravityView_View\getInstance().

Field Documentation

◆ $stack

$stack = array()
staticprivate

Definition at line 358 of file _mocks.php.


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