Example

Purpose

Example file for basing new Extenders on

Summary
ExampleExample file for basing new Extenders on
ParametersDefine any parameters needed in the extender or to override Ditto defaults
paramThe purpose of your parameter goes here
PlaceholdersDefin the values of custom placeholders for access in the tpl like so [+phname+]
$placeholders[‘example’]Add the placeholder example to the custom placeholders list with the source pagetitle in both display and backend using the exampleFunction callback and pagetitle as the field for QuickEdit.
exampleFunctionTakes the resource array for an individual document and returns the value of the placeholder, in this case the uppercase version of the pagetitle
FiltersDefine custom or basic filters within the extender to expand Ditto’s filtering capabilities
$filters[“custom”][“exampleFilter”]Add the filter exampleFilter to the custom filters list with the source pagetitle and the callback exampleFilter
exampleFilterTakes the resource array for an individual document and asks for the return of a 0 or 1 with 1 removing the document and 0 leaving it in the result set.
$filters[“parsed”][]Add the pre-parsed filter to the parsed filters list with the source as id, the value of 9239423942 and the mode 2

Parameters

Define any parameters needed in the extender or to override Ditto defaults

param

Purpose

The purpose of your parameter goes here

Options

Any options that your parameter can have go here

Default

”default”

Placeholders

Defin the values of custom placeholders for access in the tpl like so [+phname+]

$placeholders[‘example’]

Add the placeholder example to the custom placeholders list with the source pagetitle in both display and backend using the exampleFunction callback and pagetitle as the field for QuickEdit.  If you only needed the placeholder in the frontent you would just use “pagetitle” as the first value of the array.  If the callback was in a class use the array($initialized_class,”member”) method.

exampleFunction

function exampleFunction($resource)

Takes the resource array for an individual document and returns the value of the placeholder, in this case the uppercase version of the pagetitle

Filters

Define custom or basic filters within the extender to expand Ditto’s filtering capabilities

$filters[“custom”][“exampleFilter”]

Add the filter exampleFilter to the custom filters list with the source pagetitle and the callback exampleFilter

exampleFilter

function exampleFilter($resource)

Takes the resource array for an individual document and asks for the return of a 0 or 1 with 1 removing the document and 0 leaving it in the result set.  In this case, if the lower case value of the pagetitle is foo, it is removed while all other documents are shown

$filters[“parsed”][]

Add the pre-parsed filter to the parsed filters list with the source as id, the value of 9239423942 and the mode 2

function exampleFunction($resource)
Takes the resource array for an individual document and returns the value of the placeholder, in this case the uppercase version of the pagetitle
function exampleFilter($resource)
Takes the resource array for an individual document and asks for the return of a 0 or 1 with 1 removing the document and 0 leaving it in the result set.