AbstractPlugin uses DefaultJavaScriptAssetTrait
Old school base class of frontend plugins.
since TYPO3 v12.4. Will be removed in TYPO3 v13.0.
Various legacy frontend plugins extend this "abstract".
The class comes with a series of helper methods which assist plugins in creating lists, searching, displaying menus, page-browsing (next/previous/1/2/3) and handling links. Functions are all prefixed "pi_" which is reserved for this class. Those functions can of course be overridden in the extension classes (that is the point...)
This class is not maintained anymore and may be removed in future versions.
Table of Contents
Properties
- $altLLkey : string
- Pointer to alternative fall-back language to use.
- $conf : array<string|int, mixed>
- Should normally be set in the main function with the TypoScript content passed to the method.
- $extKey : string
- Extension key.
- $internal : array<string|int, mixed>
- Local pointer variable array.
- $LLkey : string
- Pointer to the language to use.
- $LLtestPrefix : string
- You can set this during development to some value that makes it easy for you to spot all labels that ARe delivered by the getLL function.
- $LLtestPrefixAlt : string
- Save as LLtestPrefix, but additional prefix for the alternative value in getLL() function calls
- $LOCAL_LANG : array<string|int, mixed>
- Local Language content
- $LOCAL_LANG_loaded : bool
- Flag that tells if the locallang file has been fetch (or tried to be fetched) already.
- $pi_alwaysPrev : int
- $pi_autoCacheEn : bool
- $pi_autoCacheFields : array<string|int, mixed>
- $pi_isOnlyFields : string
- $pi_listFields : string
- $pi_lowerThan : int
- $pi_moreParams : string
- $pi_tmpPageId : int
- $piVars : array<string|int, mixed>
- This is the incoming array by name $this->prefixId merged between POST and GET, POST taking precedence.
- $prefixId : string
- Should be same as classname of the plugin, used for CSS classes, variables
- $scriptRelPath : string
- Path to the plugin class script relative to extension directory, eg. 'pi1/class.tx_newfaq_pi1.php'
- $cObj : ContentObjectRenderer|null
- $defaultFrontendJavaScriptFile : string
- $frontendController : TypoScriptFrontendController
- Property for accessing TypoScriptFrontendController centrally
- $LOCAL_LANG_UNSET : array<string|int, mixed>
- Contains those LL keys, which have been set to (empty) in TypoScript.
- $templateService : MarkerBasedTemplateService
Methods
- __construct() : mixed
- Class Constructor (true constructor) Initializes $this->piVars if $this->prefixId is set to any value Will also set $this->LLkey based on the config.language setting.
- pi_autoCache() : bool|null
- Returns TRUE if the array $inArray contains only values allowed to be cached based on the configuration in $this->pi_autoCacheFields Used by ->pi_linkTP_keepPIvars This is an advanced form of evaluation of whether a URL should be cached or not.
- pi_classParam() : string
- Returns the class-attribute with the correctly prefixed classname Using pi_getClassName()
- pi_exec_query() : Result
- Executes a standard SELECT query for listing of records based on standard input vars from the 'browser' ($this->internal['results_at_a_time'] and $this->piVars['pointer']) and 'searchbox' ($this->piVars['sword'] and $this->internal['searchFieldList']) Set $count to 1 if you wish to get a count(*) query for selecting the number of results.
- pi_getCategoryTableContents() : array<string|int, mixed>
- Will select all records from the "category table", $table, and return them in an array.
- pi_getClassName() : string
- Returns a class-name prefixed with $this->prefixId and with all underscores substituted to dashes (-)
- pi_getFFvalue() : string|null
- Return value from somewhere inside a FlexForm structure
- pi_getFFvalueFromSheetArray() : mixed
- Returns part of $sheetArray pointed to by the keys in $fieldNameArray
- pi_getLL() : string
- Returns the localized label of the LOCAL_LANG key, $key Notice that for debugging purposes prefixes for the output values can be set with the internal vars ->LLtestPrefixAlt and ->LLtestPrefix
- pi_getPageLink() : string
- Get URL to some page.
- pi_getPidList() : string
- Returns a commalist of page ids for a query (eg. 'WHERE pid IN (...)')
- pi_getRecord() : array<string|int, mixed>
- Returns the row $uid from $table (Simply calling $this->frontendEngine->sys_page->checkRecord())
- pi_initPIflexForm() : mixed
- Converts $this->cObj->data['pi_flexform'] from XML string to flexForm array.
- pi_isOnlyFields() : bool|null
- Returns TRUE if the piVars array has ONLY those fields entered that is set in the $fList (commalist) AND if none of those fields value is greater than $lowerThan field if they are integers.
- pi_linkToPage() : string
- Link a string to some page.
- pi_linkTP() : string
- Link string to the current page.
- pi_linkTP_keepPIvars() : string
- Link a string to the current page while keeping currently set values in piVars.
- pi_linkTP_keepPIvars_url() : string
- Get URL to the current page while keeping currently set values in piVars.
- pi_list_browseresults() : string
- Returns a results browser. This means a bar of page numbers plus a "previous" and "next" link. For each entry in the bar the piVars "pointer" will be pointing to the "result page" to show.
- pi_list_header() : string
- Returns a list header row.
- pi_list_linkSingle() : string
- Wraps the $str in a link to a single display of the record (using piVars[showUid]) Uses pi_linkTP for the linking
- pi_list_makelist() : string
- Returns the list of items based on the input SQL result pointer For each result row the internal var, $this->internal['currentRow'], is set with the row returned.
- pi_list_modeSelector() : string
- Returns a mode selector; a little menu in a table normally put in the top of the page/list.
- pi_list_row() : string
- Returns a list row. Get data from $this->internal['currentRow']; (Dummy) Notice: This function should ALWAYS be defined in the extension class of the plugin since it is directly concerned with the specific layout of the listing for your plugins purpose.
- pi_loadLL() : mixed
- Loads local-language values from the file passed as a parameter or by looking for a "locallang" file in the plugin class directory ($this->scriptRelPath).
- pi_openAtagHrefInJSwindow() : string
- Will change the href value from <a> in the input string and turn it into markup that will open a new window with the URL
- pi_prependFieldsWithTable() : string
- Having a comma list of fields ($fieldList) this is prepended with the $table.'.' name
- pi_RTEcssText() : string
- Will process the input string with the parseFunc function from ContentObjectRenderer based on configuration set in "lib.parseFunc_RTE" in the current TypoScript template.
- pi_setPiVarDefaults() : mixed
- If internal TypoScript property "_DEFAULT_PI_VARS." is set then it will merge the current $this->piVars array onto these default values.
- pi_wrapInBaseClass() : string
- Wraps the input string in a <div> tag with the class attribute set to the prefixId.
- setContentObjectRenderer() : void
- This setter is called when the plugin is called from UserContentObject (USER) via ContentObjectRenderer->callUserFunction().
- addDefaultFrontendJavaScript() : void
- applyStdWrapRecursive() : array<string|int, mixed>
- Recursively looks for stdWrap and executes it
- removeInternalNodeValue() : array<string|int, mixed>
- Remove the internal array key _typoScriptNodeValue
- shallExportDefaultFrontendJavaScript() : bool
- shallRemoveDefaultFrontendJavaScript() : bool
Properties
$altLLkey
Pointer to alternative fall-back language to use.
public
string
$altLLkey
= ''
$conf
Should normally be set in the main function with the TypoScript content passed to the method.
public
array<string|int, mixed>
$conf
= []
$conf[LOCAL_LANG][key] is reserved for Local Language overrides. $conf[userFunc] reserved for setting up the USER / USER_INT object. See TSref
$extKey
Extension key.
public
string
$extKey
$internal
Local pointer variable array.
public
array<string|int, mixed>
$internal
= ['res_count' => 0, 'results_at_a_time' => 20, 'maxPages' => 10, 'currentRow' => [], 'currentTable' => '']
Holds pointer information for the MVC like approach Kasper initially proposed.
$LLkey
Pointer to the language to use.
public
string
$LLkey
= 'default'
$LLtestPrefix
You can set this during development to some value that makes it easy for you to spot all labels that ARe delivered by the getLL function.
public
string
$LLtestPrefix
= ''
$LLtestPrefixAlt
Save as LLtestPrefix, but additional prefix for the alternative value in getLL() function calls
public
string
$LLtestPrefixAlt
= ''
$LOCAL_LANG
Local Language content
public
array<string|int, mixed>
$LOCAL_LANG
= []
$LOCAL_LANG_loaded
Flag that tells if the locallang file has been fetch (or tried to be fetched) already.
public
bool
$LOCAL_LANG_loaded
= false
$pi_alwaysPrev
public
int
$pi_alwaysPrev
= 0
$pi_autoCacheEn
public
bool
$pi_autoCacheEn
= false
$pi_autoCacheFields
public
array<string|int, mixed>
$pi_autoCacheFields
= []
$pi_isOnlyFields
public
string
$pi_isOnlyFields
= 'mode,pointer'
$pi_listFields
public
string
$pi_listFields
= '*'
$pi_lowerThan
public
int
$pi_lowerThan
= 5
$pi_moreParams
public
string
$pi_moreParams
= ''
$pi_tmpPageId
public
int
$pi_tmpPageId
= 0
$piVars
This is the incoming array by name $this->prefixId merged between POST and GET, POST taking precedence.
public
array<string|int, mixed>
$piVars
= [
'pointer' => '',
// Used as a pointer for lists
'mode' => '',
// List mode
'sword' => '',
// Search word
'sort' => '',
]
Eg. if the class name is 'tx_myext' then the content of this array will be whatever comes into &tx_myext[...]=...
$prefixId
Should be same as classname of the plugin, used for CSS classes, variables
public
string
$prefixId
$scriptRelPath
Path to the plugin class script relative to extension directory, eg. 'pi1/class.tx_newfaq_pi1.php'
public
string
$scriptRelPath
$cObj
protected
ContentObjectRenderer|null
$cObj
= null
$defaultFrontendJavaScriptFile
protected
string
$defaultFrontendJavaScriptFile
= 'EXT:frontend/Resources/Public/JavaScript/default_frontend.js'
$frontendController
Property for accessing TypoScriptFrontendController centrally
protected
TypoScriptFrontendController
$frontendController
$LOCAL_LANG_UNSET
Contains those LL keys, which have been set to (empty) in TypoScript.
protected
array<string|int, mixed>
$LOCAL_LANG_UNSET
= []
This is necessary, as we cannot distinguish between a nonexisting translation and a label that has been cleared by TS. In both cases ['key'][0]['target'] is "".
$templateService
protected
MarkerBasedTemplateService
$templateService
Methods
__construct()
Class Constructor (true constructor) Initializes $this->piVars if $this->prefixId is set to any value Will also set $this->LLkey based on the config.language setting.
public
__construct([null $_ = null ][, TypoScriptFrontendController|null $frontendController = null ]) : mixed
Parameters
- $_ : null = null
-
unused,
- $frontendController : TypoScriptFrontendController|null = null
pi_autoCache()
Returns TRUE if the array $inArray contains only values allowed to be cached based on the configuration in $this->pi_autoCacheFields Used by ->pi_linkTP_keepPIvars This is an advanced form of evaluation of whether a URL should be cached or not.
public
pi_autoCache(array<string|int, mixed> $inArray) : bool|null
Parameters
- $inArray : array<string|int, mixed>
-
An array with piVars values to evaluate
Tags
Return values
bool|null —Returns TRUE (1) if conditions are met.
pi_classParam()
Returns the class-attribute with the correctly prefixed classname Using pi_getClassName()
public
pi_classParam(string $class[, string $addClasses = '' ]) : string
Parameters
- $class : string
-
The class name(s) (suffix) - separate multiple classes with commas
- $addClasses : string = ''
-
Additional class names which should not be prefixed - separate multiple classes with commas
Tags
Return values
string —A "class" attribute with value and a single space char before it.
pi_exec_query()
Executes a standard SELECT query for listing of records based on standard input vars from the 'browser' ($this->internal['results_at_a_time'] and $this->piVars['pointer']) and 'searchbox' ($this->piVars['sword'] and $this->internal['searchFieldList']) Set $count to 1 if you wish to get a count(*) query for selecting the number of results.
public
pi_exec_query(string $table[, bool $count = false ][, string $addWhere = '' ][, mixed $mm_cat = '' ][, string $groupBy = '' ][, string $orderBy = '' ][, string $query = '' ]) : Result
Notice that the query will use $this->conf['pidList'] and $this->conf['recursive'] to generate a PID list within which to search for records.
Parameters
- $table : string
-
The table name to make the query for.
- $count : bool = false
-
If set, you will get a "count(*)" query back instead of field selecting
- $addWhere : string = ''
-
Additional WHERE clauses (should be starting with " AND ....")
- $mm_cat : mixed = ''
-
If an array, then it must contain the keys "table", "mmtable" and (optionally) "catUidList" defining a table to make a MM-relation to in the query (based on fields uid_local and uid_foreign). If not array, the query will be a plain query looking up data in only one table.
- $groupBy : string = ''
-
If set, this is added as a " GROUP BY ...." part of the query.
- $orderBy : string = ''
-
If set, this is added as a " ORDER BY ...." part of the query. The default is that an ORDER BY clause is made based on $this->internal['orderBy'] and $this->internal['descFlag'] where the orderBy field must be found in $this->internal['orderByList']
- $query : string = ''
-
If set, this is taken as the first part of the query instead of what is created internally. Basically this should be a query starting with "FROM [table] WHERE ... AND ...". The $addWhere clauses and all the other stuff is still added. Only the tables and PID selecting clauses are bypassed. May be deprecated in the future!
Return values
Resultpi_getCategoryTableContents()
Will select all records from the "category table", $table, and return them in an array.
public
pi_getCategoryTableContents(string $table, int $pid[, string $whereClause = '' ][, string $groupBy = '' ][, string $orderBy = '' ][, string $limit = '' ]) : array<string|int, mixed>
Parameters
- $table : string
-
The name of the category table to select from.
- $pid : int
-
The page from where to select the category records.
- $whereClause : string = ''
-
Optional additional WHERE clauses put in the end of the query. DO NOT PUT IN GROUP BY, ORDER BY or LIMIT!
- $groupBy : string = ''
-
Optional GROUP BY field(s), if none, supply blank string.
- $orderBy : string = ''
-
Optional ORDER BY field(s), if none, supply blank string.
- $limit : string = ''
-
Optional LIMIT value ([begin,]max), if none, supply blank string.
Return values
array<string|int, mixed> —The array with the category records in.
pi_getClassName()
Returns a class-name prefixed with $this->prefixId and with all underscores substituted to dashes (-)
public
pi_getClassName(string $class) : string
Parameters
- $class : string
-
The class name (or the END of it since it will be prefixed by $this->prefixId.'-')
Return values
string —The combined class name (with the correct prefix)
pi_getFFvalue()
Return value from somewhere inside a FlexForm structure
public
pi_getFFvalue(array<string|int, mixed> $T3FlexForm_array, string $fieldName[, string $sheet = 'sDEF' ][, string $lang = 'lDEF' ][, string $value = 'vDEF' ]) : string|null
Parameters
- $T3FlexForm_array : array<string|int, mixed>
-
FlexForm data
- $fieldName : string
-
Field name to extract. Can be given like "test/el/2/test/el/field_templateObject" where each part will dig a level deeper in the FlexForm data.
- $sheet : string = 'sDEF'
-
Sheet pointer, eg. "sDEF
- $lang : string = 'lDEF'
-
Language pointer, eg. "lDEF
- $value : string = 'vDEF'
-
Value pointer, eg. "vDEF
Return values
string|null —The content.
pi_getFFvalueFromSheetArray()
Returns part of $sheetArray pointed to by the keys in $fieldNameArray
public
pi_getFFvalueFromSheetArray(array<string|int, mixed> $sheetArray, array<string|int, mixed> $fieldNameArr, string $value) : mixed
Parameters
- $sheetArray : array<string|int, mixed>
-
Multidimensional array, typically FlexForm contents
- $fieldNameArr : array<string|int, mixed>
-
Array where each value points to a key in the FlexForms content - the input array will have the value returned pointed to by these keys. All integer keys will not take their integer counterparts, but rather traverse the current position in the array and return element number X (whether this is right behavior is not settled yet...)
- $value : string
-
Value for outermost key, typ. "vDEF" depending on language.
Tags
Return values
mixed —The value, typ. string.
pi_getLL()
Returns the localized label of the LOCAL_LANG key, $key Notice that for debugging purposes prefixes for the output values can be set with the internal vars ->LLtestPrefixAlt and ->LLtestPrefix
public
pi_getLL(string $key[, string $alternativeLabel = '' ]) : string
Parameters
- $key : string
-
The key from the LOCAL_LANG array for which to return the value.
- $alternativeLabel : string = ''
-
Alternative string to return IF no value is found set for the key, neither for the local language nor the default.
Return values
string —The value from LOCAL_LANG.
pi_getPageLink()
Get URL to some page.
public
pi_getPageLink(int $id[, string $target = '' ][, array<string|int, mixed>|string $urlParameters = [] ]) : string
Returns the URL to page $id with $target and an array of additional url-parameters, $urlParameters Simple example: $this->pi_getPageLink(123) to get the URL for page-id 123.
The function basically calls $this->cObj->getTypoLink_URL()
Parameters
- $id : int
-
Page id
- $target : string = ''
-
Target value to use. Affects the &type-value of the URL, defaults to current.
- $urlParameters : array<string|int, mixed>|string = []
-
As an array key/value pairs represent URL parameters to set. Values NOT URL-encoded yet, keys should be URL-encoded if needed. As a string the parameter is expected to be URL-encoded already.
Tags
Return values
string —The resulting URL
pi_getPidList()
Returns a commalist of page ids for a query (eg. 'WHERE pid IN (...)')
public
pi_getPidList(string $pid_list[, int $recursive = 0 ]) : string
Parameters
- $pid_list : string
-
A comma list of page ids (if empty current page is used)
- $recursive : int = 0
-
An integer >=0 telling how deep to dig for pids under each entry in $pid_list
Return values
string —List of PID values (comma separated)
pi_getRecord()
Returns the row $uid from $table (Simply calling $this->frontendEngine->sys_page->checkRecord())
public
pi_getRecord(string $table, int $uid[, bool $checkPage = false ]) : array<string|int, mixed>
Parameters
- $table : string
-
The table name
- $uid : int
-
The uid of the record from the table
- $checkPage : bool = false
-
If $checkPage is set, it's required that the page on which the record resides is accessible
Return values
array<string|int, mixed> —If record is found, an array. Otherwise FALSE.
pi_initPIflexForm()
Converts $this->cObj->data['pi_flexform'] from XML string to flexForm array.
public
pi_initPIflexForm([string $field = 'pi_flexform' ]) : mixed
Parameters
- $field : string = 'pi_flexform'
-
Field name to convert
pi_isOnlyFields()
Returns TRUE if the piVars array has ONLY those fields entered that is set in the $fList (commalist) AND if none of those fields value is greater than $lowerThan field if they are integers.
public
pi_isOnlyFields(string $fList[, int $lowerThan = -1 ]) : bool|null
Notice that this function will only work as long as values are integers.
Parameters
- $fList : string
-
List of fields (keys from piVars) to evaluate on
- $lowerThan : int = -1
-
Limit for the values.
Return values
bool|null —Returns TRUE (1) if conditions are met.
pi_linkToPage()
Link a string to some page.
public
pi_linkToPage(string $str, int $id[, string $target = '' ][, array<string|int, mixed>|string $urlParameters = [] ]) : string
Like pi_getPageLink() but takes a string as first parameter which will in turn be wrapped with the URL including target attribute Simple example: $this->pi_linkToPage('My link', 123) to get something like My link
Parameters
- $str : string
-
The content string to wrap in tags
- $id : int
-
Page id
- $target : string = ''
-
Target value to use. Affects the &type-value of the URL, defaults to current.
- $urlParameters : array<string|int, mixed>|string = []
-
As an array key/value pairs represent URL parameters to set. Values NOT URL-encoded yet, keys should be URL-encoded if needed. As a string the parameter is expected to be URL-encoded already.
Tags
Return values
string —The input string wrapped in tags with the URL and target set.
pi_linkTP()
Link string to the current page.
public
pi_linkTP(string $str[, array<string|int, mixed> $urlParameters = [] ][, bool $cache = false ][, int $altPageId = 0 ]) : string
Returns the $str wrapped in -tags with a link to the CURRENT page, but with $urlParameters set as extra parameters for the page.
Parameters
- $str : string
-
The content string to wrap in tags
- $urlParameters : array<string|int, mixed> = []
-
Array with URL parameters as key/value pairs. They will be "imploded" and added to the list of parameters defined in the plugins TypoScript property "parent.addParams" plus $this->pi_moreParams.
- $cache : bool = false
-
If $cache is set (0/1), the page is asked to be cached by a &cHash value (unless the current plugin using this class is a USER_INT). Otherwise the no_cache-parameter will be a part of the link.
- $altPageId : int = 0
-
Alternative page ID for the link. (By default this function links to the SAME page!)
Tags
Return values
string —The input string wrapped in tags
pi_linkTP_keepPIvars()
Link a string to the current page while keeping currently set values in piVars.
public
pi_linkTP_keepPIvars(string $str[, array<string|int, mixed> $overrulePIvars = [] ][, bool $cache = false ][, bool $clearAnyway = false ][, int $altPageId = 0 ]) : string
Like pi_linkTP, but $urlParameters is by default set to $this->piVars with $overrulePIvars overlaid. This means any current entries from this->piVars are passed on (except the key "DATA" which will be unset before!) and entries in $overrulePIvars will OVERRULE the current in the link.
Parameters
- $str : string
-
The content string to wrap in tags
- $overrulePIvars : array<string|int, mixed> = []
-
Array of values to override in the current piVars. Contrary to pi_linkTP the keys in this array must correspond to the real piVars array and therefore NOT be prefixed with the $this->prefixId string. Further, if a value is a blank string it means the piVar key will not be a part of the link (unset)
- $cache : bool = false
-
If $cache is set, the page is asked to be cached by a &cHash value (unless the current plugin using this class is a USER_INT). Otherwise the no_cache-parameter will be a part of the link.
- $clearAnyway : bool = false
-
If set, then the current values of piVars will NOT be preserved anyways... Practical if you want an easy way to set piVars without having to worry about the prefix, "tx_xxxxx[]
- $altPageId : int = 0
-
Alternative page ID for the link. (By default this function links to the SAME page!)
Tags
Return values
string —The input string wrapped in tags
pi_linkTP_keepPIvars_url()
Get URL to the current page while keeping currently set values in piVars.
public
pi_linkTP_keepPIvars_url([array<string|int, mixed> $overrulePIvars = [] ][, bool $cache = false ][, bool $clearAnyway = false ][, int $altPageId = 0 ]) : string
Same as pi_linkTP_keepPIvars but returns only the URL from the link.
Parameters
- $overrulePIvars : array<string|int, mixed> = []
-
See pi_linkTP_keepPIvars
- $cache : bool = false
-
See pi_linkTP_keepPIvars
- $clearAnyway : bool = false
-
See pi_linkTP_keepPIvars
- $altPageId : int = 0
-
See pi_linkTP_keepPIvars
Tags
Return values
string —The URL ($this->cObj->lastTypoLinkResult)
pi_list_browseresults()
Returns a results browser. This means a bar of page numbers plus a "previous" and "next" link. For each entry in the bar the piVars "pointer" will be pointing to the "result page" to show.
public
pi_list_browseresults([int $showResultCount = 1 ][, string $tableParams = '' ][, array<string|int, mixed> $wrapArr = [] ][, string $pointerName = 'pointer' ][, bool $hscText = true ][, bool $forceOutput = false ]) : string
Using $this->piVars['pointer'] as pointer to the page to display. Can be overwritten with another string ($pointerName) to make it possible to have more than one pagebrowser on a page) Using $this->internal['res_count'], $this->internal['results_at_a_time'] and $this->internal['maxPages'] for count number, how many results to show and the max number of pages to include in the browse bar. Using $this->internal['dontLinkActivePage'] as switch if the active (current) page should be displayed as pure text or as a link to itself Using $this->internal['showFirstLast'] as switch if the two links named "<< First" and "LAST >>" will be shown and point to the first or last page. Using $this->internal['pagefloat']: this defines were the current page is shown in the list of pages in the Pagebrowser. If this var is an integer it will be interpreted as position in the list of pages. If its value is the keyword "center" the current page will be shown in the middle of the pagelist. Using $this->internal['showRange']: this var switches the display of the pagelinks from pagenumbers to ranges f.e.: 1-5 6-10 11-15... instead of 1 2 3... Using $this->pi_isOnlyFields: this holds a comma-separated list of fieldnames which - if they are among the GETvars - will not disable caching for the page with pagebrowser.
The third parameter is an array with several wraps for the parts of the pagebrowser. The following elements will be recognized: disabledLinkWrap, inactiveLinkWrap, activeLinkWrap, browseLinksWrap, showResultsWrap, showResultsNumbersWrap, browseBoxWrap.
If $wrapArr['showResultsNumbersWrap'] is set, the formatting string is expected to hold template markers (###FROM###, ###TO###, ###OUT_OF###, ###FROM_TO###, ###CURRENT_PAGE###, ###TOTAL_PAGES###) otherwise the formatting string is expected to hold sprintf-markers (%s) for from, to, outof (in that sequence)
Parameters
- $showResultCount : int = 1
-
Determines how the results of the page browser will be shown. See description below
- $tableParams : string = ''
-
Attributes for the table tag which is wrapped around the table cells containing the browse links
- $wrapArr : array<string|int, mixed> = []
-
Array with elements to overwrite the default $wrapper-array.
- $pointerName : string = 'pointer'
-
varname for the pointer.
- $hscText : bool = true
-
Enable htmlspecialchars() on language labels
- $forceOutput : bool = false
-
Forces the output of the page browser if you set this option to "TRUE" (otherwise it's only drawn if enough entries are available)
Return values
string —Output HTML-Table, wrapped in
pi_list_header()
Returns a list header row.
public
pi_list_header() : string
(Dummy) Notice: This function should ALWAYS be defined in the extension class of the plugin since it is directly concerned with the specific layout of the listing for your plugins purpose.
Return values
string —HTML output, a table row with a class attribute set
pi_list_linkSingle()
Wraps the $str in a link to a single display of the record (using piVars[showUid]) Uses pi_linkTP for the linking
public
pi_list_linkSingle(string $str, int $uid[, bool $cache = false ][, array<string|int, mixed> $mergeArr = [] ][, bool $urlOnly = false ][, int $altPageId = 0 ]) : string
Parameters
- $str : string
-
The content string to wrap in tags
- $uid : int
-
UID of the record for which to display details (basically this will become the value of [showUid]
- $cache : bool = false
-
See pi_linkTP_keepPIvars
- $mergeArr : array<string|int, mixed> = []
-
Array of values to override in the current piVars. Same as $overrulePIvars in pi_linkTP_keepPIvars
- $urlOnly : bool = false
-
If TRUE, only the URL is returned, not a full link
- $altPageId : int = 0
-
Alternative page ID for the link. (By default this function links to the SAME page!)
Tags
Return values
string —The input string wrapped in tags
pi_list_makelist()
Returns the list of items based on the input SQL result pointer For each result row the internal var, $this->internal['currentRow'], is set with the row returned.
public
pi_list_makelist(Result $statement[, string $tableParams = '' ]) : string
$this->pi_list_header() makes the header row for the list $this->pi_list_row() is used for rendering each row Notice that these two functions are typically ALWAYS defined in the extension class of the plugin since they are directly concerned with the specific layout for that plugins purpose.
Parameters
- $statement : Result
-
Result pointer to a SQL result which can be traversed.
- $tableParams : string = ''
-
Attributes for the table tag which is wrapped around the table rows containing the list
Tags
Return values
string —Output HTML, wrapped in
pi_list_modeSelector()
Returns a mode selector; a little menu in a table normally put in the top of the page/list.
public
pi_list_modeSelector([array<string|int, mixed> $items = [] ][, string $tableParams = '' ]) : string
Parameters
- $items : array<string|int, mixed> = []
-
Key/Value pairs for the menu; keys are the piVars[mode] values and the "values" are the labels for them.
- $tableParams : string = ''
-
Attributes for the table tag which is wrapped around the table cells containing the menu
Return values
string —Output HTML, wrapped in
pi_list_row()
Returns a list row. Get data from $this->internal['currentRow']; (Dummy) Notice: This function should ALWAYS be defined in the extension class of the plugin since it is directly concerned with the specific layout of the listing for your plugins purpose.
public
pi_list_row(int $c) : string
Parameters
- $c : int
-
Row counting. Starts at 0 (zero). Used for alternating class values in the output rows.
Return values
string —HTML output, a table row with a class attribute set (alternative based on odd/even rows)
pi_loadLL()
Loads local-language values from the file passed as a parameter or by looking for a "locallang" file in the plugin class directory ($this->scriptRelPath).
public
pi_loadLL([string $languageFilePath = '' ]) : mixed
Also locallang values set in the TypoScript property "_LOCAL_LANG" are merged onto the values found in the "locallang" file. Supported file extensions xlf
Parameters
- $languageFilePath : string = ''
-
path to the plugin language file in format EXT:....
pi_openAtagHrefInJSwindow()
Will change the href value from <a> in the input string and turn it into markup that will open a new window with the URL
public
pi_openAtagHrefInJSwindow(string $str[, string $winName = '' ][, string $winParams = 'width=670,height=500,status=0,menubar=0,scrollbars=1,resizable=1' ]) : string
Parameters
- $str : string
-
The string to process. This should be a string already wrapped/including a tag, only the
href
attribute will be used - $winName : string = ''
-
Window name for the pop-up window
- $winParams : string = 'width=670,height=500,status=0,menubar=0,scrollbars=1,resizable=1'
-
Window parameters, see the default list for inspiration
Return values
string —The processed input string, modified IF a tag was found
pi_prependFieldsWithTable()
Having a comma list of fields ($fieldList) this is prepended with the $table.'.' name
public
pi_prependFieldsWithTable(string $table, string $fieldList) : string
Parameters
- $table : string
-
Table name to prepend
- $fieldList : string
-
List of fields where each element will be prepended with the table name given.
Return values
string —List of fields processed.
pi_RTEcssText()
Will process the input string with the parseFunc function from ContentObjectRenderer based on configuration set in "lib.parseFunc_RTE" in the current TypoScript template.
public
pi_RTEcssText(string $str) : string
Parameters
- $str : string
-
The input text string to process
Tags
Return values
string —The processed string
pi_setPiVarDefaults()
If internal TypoScript property "_DEFAULT_PI_VARS." is set then it will merge the current $this->piVars array onto these default values.
public
pi_setPiVarDefaults() : mixed
pi_wrapInBaseClass()
Wraps the input string in a <div> tag with the class attribute set to the prefixId.
public
pi_wrapInBaseClass(string $str) : string
All content returned from your plugins should be returned through this function so all content from your plugin is encapsulated in a
Parameters
- $str : string
-
HTML content to wrap in the div-tags with the "main class" of the plugin
Return values
string —HTML content wrapped, ready to return to the parent object.
setContentObjectRenderer()
This setter is called when the plugin is called from UserContentObject (USER) via ContentObjectRenderer->callUserFunction().
public
setContentObjectRenderer(ContentObjectRenderer $cObj) : void
Parameters
- $cObj : ContentObjectRenderer
addDefaultFrontendJavaScript()
protected
addDefaultFrontendJavaScript() : void
applyStdWrapRecursive()
Recursively looks for stdWrap and executes it
protected
applyStdWrapRecursive(array<string|int, mixed> $conf[, int $level = 0 ]) : array<string|int, mixed>
Parameters
- $conf : array<string|int, mixed>
-
Current section of configuration to work on
- $level : int = 0
-
Current level being processed (currently just for tracking; no limit enforced)
Return values
array<string|int, mixed> —Current section of configuration after stdWrap applied
removeInternalNodeValue()
Remove the internal array key _typoScriptNodeValue
protected
removeInternalNodeValue(array<string|int, mixed> $typoscript) : array<string|int, mixed>
Parameters
- $typoscript : array<string|int, mixed>
Return values
array<string|int, mixed>shallExportDefaultFrontendJavaScript()
protected
shallExportDefaultFrontendJavaScript() : bool
Return values
boolshallRemoveDefaultFrontendJavaScript()
protected
shallRemoveDefaultFrontendJavaScript() : bool