silverstripe-framework/view/TemplateIteratorProvider.php
Damian Mooyman 5c9044a007 API Enforce default_cast for all field usages
API Introduce HTMLFragment as casting helper for HTMLText with shortcodes disabled
API Introduce DBField::CDATA for XML file value encoding
API RSSFeed now casts from the underlying model rather than by override
API Introduce CustomMethods::getExtraMethodConfig() to allow metadata to be queried
BUG Remove _call hack from VirtualPage
API Remove FormField::$dontEscape
API Introduce HTMLReadonlyField for non-editable readonly HTML
API FormField::Field() now returns string in many cases rather than DBField instance.
API Remove redundant *_val methods from ViewableData
API ViewableData::obj() no longer has a $forceReturnObject parameter as it always returns an object
BUG  Fix issue with ViewableData caching incorrect field values after being modified.
API Remove deprecated DB class methods
API Enforce plain text left/right formfield titles
2016-07-13 17:15:45 +12:00

48 lines
1.9 KiB
PHP

<?php
/**
* Interface that is implemented by any classes that want to expose a method that can be called in any
* scope in a template that returns values dependant on the state of the iterator of the current scope.
*
* SSViewer_BasicIteratorSupport is an example of this. See also @TemplateGlobalProvider
*
* @package framework
* @subpackage core
*/
interface TemplateIteratorProvider {
/**
* Called by SSViewer to get a list of iterator variables to expose to the template, the instance method to call
* on an instance of this class to get the value for those variables, and the class to use for casting the returned
* value for use in a template
*
* If the method to call is not included for a particular template variable, a method named the same as the
* template variable will be called
*
* If the casting class is not specified for a particular template variable, ViewableData::$default_cast is used
*
* The first letter of the template variable is case-insensitive. However the method name is always case sensitive.
*
* @abstract
* @return array Returns an array of items. Each key => value pair is one of three forms:
* - template name (no key)
* - template name => method name
* - template name => array(), where the array can contain these key => value pairs
* - "method" => method name
* - "casting" => casting class to use (i.e., Varchar, HTMLFragment, etc)
*/
public static function get_template_iterator_variables();
/**
* Set the current iterator properties - where we are on the iterator.
*
* This is called by SSViewer prior to calling any of the variables exposed to the template (that is, as returned
* from a call to get_template_iterator_variables)
*
* @abstract
* @param int $pos position in iterator
* @param int $totalItems total number of items
*/
public function iteratorProperties($pos, $totalItems);
}