Skip to main content

GV\Template

The Template abstract class.

Stores information on where a template to render an object is, and other metadata.

Source: future/includes/class-gv-template.php:24

Details

  • Kind: class
  • Namespace: GV
  • Extends: GV\Gamajo_Template_Loader

Properties

PropertyTypeDescription
$located_templatestringThe located template.

Methods

MethodDescription
__construct()General template initialization.
__destruct()Disallow any cleanup for fear of loss of global data.
split_slug()Get a directory part and a full slug+name (file) components.
push_template_data()Push the current template data down the stack and set.
pop_template_data()Restore the template data from the stack.

Method Reference

__construct()

public function __construct()

General template initialization.

Sets the $plugin_directory field.

Source: future/includes/class-gv-template.php:41

__destruct()

public function __destruct()

Disallow any cleanup for fear of loss of global data.

The destructor in Gamajo 1.3.0 destroys all of $wp_query. This has the chance of inappropriately destroying valid data that's been stored under the same key.

Disallow this.

Source: future/includes/class-gv-template.php:55

split_slug()

public static function split_slug( $slug, $name=null )

Get a directory part and a full slug+name (file) components.

Parameters

NameTypeDefaultDescription
$slugstringThe slug, template base.
$namestringnullThe name, template part. Default: null

Returns

  • array — containing slug directory and slug+name.

Source: future/includes/class-gv-template.php:66

push_template_data()

public function push_template_data( $data, $var_name='data' )

Push the current template data down the stack and set.

This allows us to use the same variable in the template scope without destroying data under the same variable in a nested or parallel template.

Parameters

NameTypeDefaultDescription
$datamixedThe data to set.
$var_namestring'data'The data variable identifier (Default: "data")

Returns

  • \GV\Gamajo_Template_Loader — The current instance.

See Also

  • \Gamajo_Template_Loader::set_template_data
  • \GV\Template::pop_template_data

Source: future/includes/class-gv-template.php:89

pop_template_data()

public function pop_template_data( $var_name='data' )

Restore the template data from the stack.

Parameters

NameTypeDefaultDescription
$var_namestring'data'The data variable identifier (Default: "data")

Returns

  • $this;

See Also

  • \Gamajo_Template_Loader::set_template_data
  • \GV\Template::pop_template_data

Source: future/includes/class-gv-template.php:115