GravityView_View
Source: includes/class-template.php:26
Details
- Kind:
class - Namespace:
(global) - Extends:
GV\Gamajo_Template_Loader
Properties
| Property | Type | Description |
|---|---|---|
$filter_prefix | string | Prefix for filter names. |
$theme_template_directory | string | Directory name where custom templates for this plugin should be found in the theme. |
$plugin_directory | string | Reference to the root directory path of this plugin. |
$located_templates | array | Store templates locations that have already been located |
$template_part_slug | string | The name of the template, like "list", "table", or "datatables" |
$template_part_name | string | The name of the file part, like "body" or "single" |
$form_id | int | Gravity Forms form ID |
$view_id | int | View ID |
$fields | array | Fields for the form |
$context | string | Current screen. Defaults to "directory" or "single" |
$post_id | int | null | If in embedded post or page, the ID of it |
$form | array | Gravity Forms form array at ID $form_id |
$atts | array | Configuration for the View |
$entries | array | Entries for the current result. Single item in array for single entry View |
$total_entries | int | Total entries count for the current result. |
$back_link_label | string | The label to display back links |
$paging | array | Array with offset and page_size keys |
$sorting | array | Array with sort_field and sort_direction keys |
$hide_until_searched | bool | Whether to hide the results until a search is performed |
$_current_entry | array | Current entry in the loop |
$_current_field | array | |
$field_data | The current field data. |
Methods
Method Reference
__construct()
function __construct( $atts=[] )
Construct the view object
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$atts | array | [] | Associative array to set the data of |
Source: includes/class-template.php:182
getInstance()
static function getInstance( $passed_post=null )
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$passed_post | null | null |
Returns
Source: includes/class-template.php:226
getCurrentField()
public function getCurrentField( $key=null )
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$key | string | null | null | The key to a specific attribute of the current field |
Returns
array|mixed|null— If $key is set and attribute exists at $key, return that. If not set, return NULL. Otherwise, return current field array
Source: includes/class-template.php:239
setCurrentField()
public function setCurrentField( $passed_field )
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$passed_field | array |
Source: includes/class-template.php:271
getAtts()
public function getAtts( $key=null )
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$key | string | null | null | The key to a specific field in the fields array |
Returns
array|mixed|null— If $key is set and field exists at $key, return that. If not set, return NULL. Otherwise, return array of fields.
Source: includes/class-template.php:291
setAtts()
public function setAtts( $atts )
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$atts | array |
Source: includes/class-template.php:306
getForm()
public function getForm()
Returns
array
Source: includes/class-template.php:313
setForm()
public function setForm( $form )
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$form | array |
Source: includes/class-template.php:320
getPostId()
public function getPostId()
Returns
int|null
Source: includes/class-template.php:327
setPostId()
public function setPostId( $post_id )
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$post_id | int | null |
Source: includes/class-template.php:334
getContext()
public function getContext()
Returns
string
Source: includes/class-template.php:341
setContext()
public function setContext( $context )
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$context | string |
Source: includes/class-template.php:348
getFields()
public function getFields( $key=null )
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$key | string | null | null | The key to a specific field in the fields array |
Returns
array|mixed|null— If $key is set and field exists at $key, return that. If not set, return NULL. Otherwise, return array of fields.
Source: includes/class-template.php:356
getContextFields()
public function getContextFields( $context='' )
Get the fields for a specific context
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$context | string | '' | [Optional] "directory", "single", or "edit" |
Returns
array— Array of GravityView field layout configurations
Since: 1.19.2
Source: includes/class-template.php:376
setFields()
public function setFields( $fields )
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$fields | array |
Source: includes/class-template.php:400
getField()
public function getField( $key )
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$key | string | The key to a specific field in the fields array |
Returns
array|mixed|null— If $key is set and field exists at $key, return that. If not set, return NULL. Otherwise, return array of fields.
Source: includes/class-template.php:408
setField()
public function setField( $key, $value )
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$key | string | The key to a specific field in the fields array | |
$value | mixed | The value to set for the field |
Source: includes/class-template.php:423
getViewId()
public function getViewId()
Returns
int
Source: includes/class-template.php:430
setViewId()
public function setViewId( $view_id )
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$view_id | int |
Source: includes/class-template.php:437
getFormId()
public function getFormId()
Returns
int
Source: includes/class-template.php:444
setFormId()
public function setFormId( $form_id )
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$form_id | int |
Source: includes/class-template.php:451
getEntries()
public function getEntries()
Returns
array
Source: includes/class-template.php:458
setEntries()
public function setEntries( $entries )
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$entries | array |
Source: includes/class-template.php:465
getTotalEntries()
public function getTotalEntries()
Returns
int
Source: includes/class-template.php:472
setTotalEntries()
public function setTotalEntries( $total_entries )
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$total_entries | int |
Source: includes/class-template.php:479
getPaging()
public function getPaging()
Returns
array
Source: includes/class-template.php:486
setPaging()
public function setPaging( $paging )
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$paging | array |
Source: includes/class-template.php:499
getPaginationCounts()
public function getPaginationCounts()
Get an array with pagination information
Returns
array— {
Since: 1.13
Source: includes/class-template.php:514
getSorting()
public function getSorting()
Returns
array
Source: includes/class-template.php:551
setSorting()
public function setSorting( $sorting )
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$sorting | array |
Source: includes/class-template.php:565
getBackLinkLabel()
public function getBackLinkLabel( $do_replace=true )
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$do_replace | boolean | true | Perform merge tag and shortcode processing on the label. Default: true. |
Returns
string
Since: 2.0
Deprecated: Use $template->get_back_label();
Source: includes/class-template.php:577
setBackLinkLabel()
public function setBackLinkLabel( $back_link_label )
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$back_link_label | string |
Source: includes/class-template.php:589
isHideUntilSearched()
public function isHideUntilSearched()