Overview

Namespaces

  • Charcoal
    • View
      • Mustache
      • Php
      • Twig

Classes

  • AbstractEngine
  • AbstractLoader
  • AbstractView
  • GenericView
  • Renderer
  • ViewConfig
  • ViewServiceProvider

Interfaces

  • EngineInterface
  • LoaderInterface
  • ViewableInterface
  • ViewInterface

Traits

  • ViewableTrait
  • Overview
  • Namespace
  • Class

Trait ViewableTrait

Implementation, as trait, of the Charcoal\View\ViewableInterface.

Namespace: Charcoal\View
Located at Charcoal/View/ViewableTrait.php
Methods summary
public string
# __toString( )

Render the viewable object.

Render the viewable object.

Returns

string
public Charcoal\View\ViewableInterface
# setTemplateIdent( string $templateIdent )

Set the template identifier for this viewable object.

Set the template identifier for this viewable object.

Usually, a path to a file containing the template to be rendered at runtime.

Parameters

$templateIdent
The template ID.

Returns

Charcoal\View\ViewableInterface
Chainable

Throws

InvalidArgumentException
If the template identifier is not a string.
public string
# templateIdent( )

Retrieve the template identifier for this viewable object.

Retrieve the template identifier for this viewable object.

Returns

string
public Charcoal\View\ViewableInterface
# setView( Charcoal\View\ViewInterface $view )

Set the renderable view.

Set the renderable view.

Parameters

$view
The view instance to use to render.

Returns

Charcoal\View\ViewableInterface
Chainable

Throws

InvalidArgumentException
If the view parameter is not an array or a View object.
public Charcoal\View\ViewInterface
# view( )

Retrieve the renderable view.

Retrieve the renderable view.

Returns

Charcoal\View\ViewInterface
The object's View instance.
public string
# render( string $templateIdent = null )

Render the template by the given identifier.

Render the template by the given identifier.

Usually, a path to a file containing the template to be rendered at runtime.

Parameters

$templateIdent

The template to load, parse, and render. If NULL, will use the object's previously set template identifier.

Returns

string
The rendered template.
public string
# renderTemplate( string $templateString )

Render the given template from string.

Render the given template from string.

Parameters

$templateString
The template to render from string.

Returns

string
The rendered template.
public Charcoal\View\ViewableInterface
# setViewController( Charcoal\View\ViewableInterface|object|array|null $controller )

Set a view controller for the template's context.

Set a view controller for the template's context.

Parameters

$controller
A view controller to use when rendering.

Returns

Charcoal\View\ViewableInterface
Chainable

Throws

InvalidArgumentException
If the controller is invalid.
public Charcoal\View\ViewableInterface
# viewController( )

Retrieve a view controller for the template's context.

Retrieve a view controller for the template's context.

If no controller has been defined, it will return itself.

Returns

Charcoal\View\ViewableInterface
API documentation generated by ApiGen