\Thelia\Core\Template\Smarty\PluginsTheliaLoop

The class all Smarty Thelia plugin shoud extend

Class AbstractSmartyPlugin

Summary

Methods
Properties
Constants
__construct()
getPagination()
theliaCount()
theliaLoop()
theliaElseloop()
theliaIfLoop()
theliaPageLoop()
setLoopList()
getPluginDescriptors()
getNormalizedParam()
getParam()
No public properties found
No constants found
checkEmptyLoop()
createLoopInstance()
_explode()
$pagination
$loopDefinition
$request
$dispatcher
$securityContext
$loopstack
$varstack
N/A
No private methods found
No private properties found
N/A

Properties

$pagination

$pagination

$loopDefinition

$loopDefinition

$request

$request

$dispatcher

$dispatcher

$securityContext

$securityContext

$loopstack

$loopstack

$varstack

$varstack

Methods

__construct()

__construct(\Symfony\Component\HttpFoundation\Request $request, \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher, \Thelia\Core\Security\SecurityContext $securityContext)

Parameters

\Symfony\Component\HttpFoundation\Request $request
\Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher
\Thelia\Core\Security\SecurityContext $securityContext

getPagination()

getPagination(mixed $loopId) : \PropelModelPager

Parameters

mixed $loopId

Returns

\PropelModelPager

theliaCount()

theliaCount( $params,  $template)

Process the count function: executes a loop and return the number of items found

Parameters

$params
$template

theliaLoop()

theliaLoop(\Thelia\Core\Template\Smarty\Plugins\unknown $params, \Thelia\Core\Template\Smarty\Plugins\unknown $content, \Thelia\Core\Template\Smarty\Plugins\unknown $template, \Thelia\Core\Template\Smarty\Plugins\unknown $repeat) : string

Process {loop name="loop name" type="loop type" .

.. } ... {/loop} block

Parameters

\Thelia\Core\Template\Smarty\Plugins\unknown $params
\Thelia\Core\Template\Smarty\Plugins\unknown $content
\Thelia\Core\Template\Smarty\Plugins\unknown $template
\Thelia\Core\Template\Smarty\Plugins\unknown $repeat

Throws

\InvalidArgumentException

Returns

string

theliaElseloop()

theliaElseloop(\Thelia\Core\Template\Smarty\Plugins\unknown $params, \Thelia\Core\Template\Smarty\Plugins\unknown $content, \Thelia\Core\Template\Smarty\Plugins\unknown $template, \Thelia\Core\Template\Smarty\Plugins\unknown $repeat) : \Thelia\Core\Template\Smarty\Plugins\Ambigous

Process {elseloop rel="loopname"} .

.. {/elseloop} block

Parameters

\Thelia\Core\Template\Smarty\Plugins\unknown $params
\Thelia\Core\Template\Smarty\Plugins\unknown $content
\Thelia\Core\Template\Smarty\Plugins\unknown $template
\Thelia\Core\Template\Smarty\Plugins\unknown $repeat

Returns

\Thelia\Core\Template\Smarty\Plugins\Ambigous —

<string, unknown>

theliaIfLoop()

theliaIfLoop(\Thelia\Core\Template\Smarty\Plugins\unknown $params, \Thelia\Core\Template\Smarty\Plugins\unknown $content, \Thelia\Core\Template\Smarty\Plugins\unknown $template, \Thelia\Core\Template\Smarty\Plugins\unknown $repeat) : \Thelia\Core\Template\Smarty\Plugins\Ambigous

Process {ifloop rel="loopname"} .

.. {/ifloop} block

Parameters

\Thelia\Core\Template\Smarty\Plugins\unknown $params
\Thelia\Core\Template\Smarty\Plugins\unknown $content
\Thelia\Core\Template\Smarty\Plugins\unknown $template
\Thelia\Core\Template\Smarty\Plugins\unknown $repeat

Returns

\Thelia\Core\Template\Smarty\Plugins\Ambigous —

<string, unknown>

theliaPageLoop()

theliaPageLoop(mixed $params, mixed $content, mixed $template, mixed $repeat) : string

Process {pageloop rel="loopname"} .

.. {/pageloop} block

Parameters

mixed $params
mixed $content
mixed $template
mixed $repeat

Throws

\InvalidArgumentException

Returns

string

setLoopList()

setLoopList(array $loopDefinition)

Injects an associative array containing information for loop execution

key is loop name value is the class implementing/extending base loop classes

ex :

$loop = array( "product" => "Thelia\Loop\Product", "category" => "Thelia\Loop\Category", "myLoop" => "My\Own\Loop" );

Parameters

array $loopDefinition

Throws

\InvalidArgumentException

if loop name already exists

getPluginDescriptors()

getPluginDescriptors() : \Thelia\Core\Template\Smarty\an

Returns

\Thelia\Core\Template\Smarty\an —

array of SmartyPluginDescriptor

getNormalizedParam()

getNormalizedParam(array $params, mixed $name, mixed $default) : mixed

Get a function or block parameter value, and normalize it, trimming balnks and making it lowercase

Parameters

array $params

the parameters array

mixed $name

as single parameter name, or an array of names. In this case, the first defined parameter is returned. Use this for aliases (context, ctx, c)

mixed $default

the defaut value if parameter is missing (default to null)

Returns

mixed —

the parameter value, or the default value if it is not found.

getParam()

getParam(array $params, mixed $name, mixed $default) : mixed

Get a function or block parameter value

Parameters

array $params

the parameters array

mixed $name

as single parameter name, or an array of names. In this case, the first defined parameter is returned. Use this for aliases (context, ctx, c)

mixed $default

the defaut value if parameter is missing (default to null)

Returns

mixed —

the parameter value, or the default value if it is not found.

checkEmptyLoop()

checkEmptyLoop(\Thelia\Core\Template\Smarty\Plugins\unknown $params, \Thelia\Core\Template\Smarty\Plugins\unknown $template)

Check if a loop has returned results. The loop shoud have been executed before, or an InvalidArgumentException is thrown

Parameters

\Thelia\Core\Template\Smarty\Plugins\unknown $params
\Thelia\Core\Template\Smarty\Plugins\unknown $template

Throws

\InvalidArgumentException

createLoopInstance()

createLoopInstance( $smartyParams) : \Thelia\Core\Template\Element\BaseLoop

find the loop class with his name and construct an instance of this class

Parameters

$smartyParams

Throws

\Thelia\Core\Template\Element\Exception\InvalidElementException
\Thelia\Core\Template\Element\Exception\ElementNotFoundException

Returns

\Thelia\Core\Template\Element\BaseLoop

_explode()

_explode(\Thelia\Core\Template\Smarty\unknown $commaSeparatedValues) : \Thelia\Core\Template\Smarty\multitype:

Explode a comma separated list in a array, trimming all array elements

Parameters

\Thelia\Core\Template\Smarty\unknown $commaSeparatedValues

Returns

\Thelia\Core\Template\Smarty\multitype: