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

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

Inheritance diagram for Field_Template:
Template Field_CSV_Template Field_HTML_Template

Public Member Functions

 __construct (Field $field, View $view=null, Source $source=null, Entry $entry=null, Request $request=null)
 Initializer. More...
 
 __destruct ()
 
 render ()
 Output some HTML. More...
 
- Public Member Functions inherited from Template
 __construct ()
 General template initialization. More...
 
 __destruct ()
 Disallow any cleanup for fear of loss of global data. More...
 
 pop_template_data ( $var_name='data')
 Restore the template data from the stack. More...
 
 push_template_data ( $data, $var_name='data')
 Push the current template data down the stack and set. More...
 

Static Public Member Functions

static add_id_specific_templates ( $template)
 Enable granular template overrides based on current post, view, form, field types, etc. More...
 
- Static Public Member Functions inherited from Template
static split_slug ( $slug, $name=null)
 Get a directory part and a full slug+name (file) components. More...
 

Data Fields

 $entry
 
 $field
 
 $request
 
 $source
 
 $view
 
- Data Fields inherited from Template
 $located_template = ''
 

Static Public Attributes

static $slug
 

Protected Attributes

 $filter_prefix = 'gravityview/template/fields'
 
 $plugin_template_directory = 'templates/fields/'
 
 $theme_template_directory = 'gravityview/fields/'
 

Detailed Description

If this file is called directly, abort.

Load up the Gamajo Template Loader.

See also
https://github.com/GaryJones/Gamajo-Template-Loader The Field Template class.

Attached to a and used by a .

Definition at line 23 of file class-gv-template-field.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( Field  $field,
View  $view = null,
Source  $source = null,
Entry  $entry = null,
Request  $request = null 
)

Initializer.

Parameters
\GV\Field$fieldThe field about to be rendered.
\GV\View$viewThe view in this context, if applicable.
\GV\Source$sourceThe source (form) in this context, if applicable.
\GV\Entry$entryThe entry in this context, if applicable.
\GV\Request$requestThe request in this context, if applicable.

Add granular overrides.

Definition at line 81 of file class-gv-template-field.php.

References $entry, and $field.

◆ __destruct()

__destruct ( )

Definition at line 94 of file class-gv-template-field.php.

Member Function Documentation

◆ add_id_specific_templates()

static add_id_specific_templates (   $template)
static

Enable granular template overrides based on current post, view, form, field types, etc.

Why? See https://github.com/gravityview/GravityView/issues/1024

Parameters
\GV\Field_Template$templateThe template instance.
Returns
callable The callback bound to get_template_part. See \GV\Field_Template::__construct

Enable granular template overrides based on current post, view, form, field types, etc.

The hierarchy is as follows:

  • post-[ID of post of page where view is embedded]-view-[View ID]-field-[Field type]-html.php
  • post-[ID of post of page where view is embedded]-view-[View ID]-field-[Field inputType]-html.php
  • post-[ID of post of page where view is embedded]-view-[View ID]-field-html.php
  • post-[ID of post of page where view is embedded]-field-[Field type]-html.php
  • post-[ID of post of page where view is embedded]-field-[Field inputType]-html.php
  • post-[ID of post of page where view is embedded]-field-html.php
  • post-[ID of post of page where view is embedded]-view-[View ID]-field-[Field type].php
  • post-[ID of post of page where view is embedded]-view-[View ID]-field-[Field inputType].php
  • post-[ID of post of page where view is embedded]-view-[View ID]-field.php
  • post-[ID of post of page where view is embedded]-field-[Field type].php
  • post-[ID of post of page where view is embedded]-field-[Field inputType].php
  • post-[ID of post of page where view is embedded]-field.php
  • form-[Form ID]-field-[Field ID]-html.php
  • form-[Form ID]-field-[Field ID].php
  • form-[Form ID]-field-[Field type]-html.php
  • form-[Form ID]-field-[Field inputType]-html.php
  • form-[Form ID]-field-[Field type].php
  • form-[Form ID]-field-[Field inputType].php
  • view-[View ID]-field-[Field type]-html.php
  • view-[View ID]-field-[Field inputType]-html.php
  • view-[View ID]-field-[Field type].php
  • view-[View ID]-field-[Field inputType].php
  • field-[Field type]-html.php
  • field-[Field inputType]-html.php
  • field-[Field type].php
  • field-[Field inputType].php
  • field-html.php
  • field.php
See also
Gamajo_Template_Loader::get_template_file_names() Where the filter is
Parameters
array$templatesExisting list of templates.
string$slugName of the template base, example: html, json, xml
string$nameName of the template part.
Returns
array $templates Modified template array, merged with existing $templates values

Field-specific

Generic field templates

Legacy. Ignore some types that conflict.

Definition at line 106 of file class-gv-template-field.php.

References $class, $field_id, $form_id, $name, $post, $template, $templates, and $view_id.

◆ render()

render ( )

Output some HTML.

Returns
void

Retrieve the value.

Alter the display value according to Gravity Forms.

Prevent any PHP warnings that may be generated.

Call the Gravity Forms field value filter.

Replace merge tags for admin-only fields.

Make various pieces of data available to the template under the $gravityview scoped variable.

Runs Filter:
gravityview/template/field/context
Parameters
\GV\Template_Context$contextThe context for this template.
Since
2.0

Bake the template.

Runs Filter:
gravityview_empty_value What to display when a field is empty
Parameters
string$value(empty string)
Runs Filter:
gravityview/field/value/empty What to display when this field is empty.
Parameters
string$valueThe value to display (Default: empty string)

Definition at line 256 of file class-gv-template-field.php.

References $display_value, $entry, $field, $gf_field, $link_atts, $output, $value, gravityview(), gravityview_get_link(), gv_empty(), Legacy_Context\load(), and GravityView_API\replace_variables().

Field Documentation

◆ $entry

$entry

Definition at line 60 of file class-gv-template-field.php.

◆ $field

$field

Definition at line 45 of file class-gv-template-field.php.

◆ $filter_prefix

$filter_prefix = 'gravityview/template/fields'
protected

Definition at line 28 of file class-gv-template-field.php.

◆ $plugin_template_directory

$plugin_template_directory = 'templates/fields/'
protected

Definition at line 40 of file class-gv-template-field.php.

◆ $request

$request

Definition at line 65 of file class-gv-template-field.php.

◆ $slug

$slug
static

Definition at line 70 of file class-gv-template-field.php.

◆ $source

$source

Definition at line 55 of file class-gv-template-field.php.

◆ $theme_template_directory

$theme_template_directory = 'gravityview/fields/'
protected

Definition at line 34 of file class-gv-template-field.php.

◆ $view

$view

Definition at line 50 of file class-gv-template-field.php.


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