Skip to content

Instantly share code, notes, and snippets.

@smichaelsen
Created November 15, 2012 14:25
Show Gist options
  • Save smichaelsen/4078860 to your computer and use it in GitHub Desktop.
Save smichaelsen/4078860 to your computer and use it in GitHub Desktop.
Show hidden records with Typoscript
<?php
class Tx_MyExt_UserFunction_ShowHiddenElements {
/**
* Usage:
*
* lib.hiddenrecords = COA
* lib.hiddenrecords {
* 10 = USER
* 10.userFunc = Tx_MyExt_UserFunction_ShowHiddenElements->main
* 10.records = 1
* 20 = CONTENT
* 20 {
* table = tt_content
* select {
* # your fancy query
* }
* }
* 30 < .10
* 30.records = 0
* }
*
* @param $content
* @param $conf
*/
public function main($content, $conf) {
if (isset($conf['records']) || isset($conf['records.'])) {
$records = $GLOBALS['TSFE']->cObj->stdWrap($conf['records'], $conf['records.']) ? 1 : 0;
$GLOBALS['TSFE']->showHiddenRecords = $records;
}
if (isset($conf['pages']) || isset($conf['pages.'])) {
$page = $GLOBALS['TSFE']->cObj->stdWrap($conf['pages'], $conf['pages.']) ? 1 : 0;
$GLOBALS['TSFE']->showHiddenPage = $page;
}
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment