[TYPO3-dev] Custom enablecolumns/enableFields for pages?

Christian Weiske christian.weiske at netresearch.de
Tue Mar 29 09:08:50 CEST 2011


Hello Franz,



> I'm struggling with custom enableFields/enablecolumns for pages. They 
> don't seem to work for menus.
> I found out that some menu types (f.e. 'special =
> directory')internally use the function ->getWhere in t3slib_content
> and there is a switch especially for pages which is circumventing the
> enableFields and using this hardcoded line instead:
> 
> $query .= ' ' . $GLOBALS['TSFE']->sys_page->where_hid_del . 
> $GLOBALS['TSFE']->sys_page->where_groupAccess;
> 
> Any ideas why this is done? And more important - any idea how I could 
> get my custom enableFields working with menus? I need to restrict the 
> display of pages based on some session value.

We hook into t3lib_page::addEnableColumns()
$TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_page.php']['addEnableColumns'][]
    = 'tx_foo_enabler->enableFields';

Apart from that, we extend t3lib_pageSelect to overwrite
getMultipleGroupsWhereClause() so we can hook into that:

class ux_t3lib_pageSelect extends t3lib_pageSelect
{
    function getMultipleGroupsWhereClause($field, $table)
    {
        if ($table == 'pages') {
            return parent::getMultipleGroupsWhereClause($field, $table)
                . tx_foo_enabler::createFilterSql($table);
        } else {
            return parent::getMultipleGroupsWhereClause($field, $table);
        }
    }//function getMultipleGroupsWhereClause(..)

}

$file = 'ext/aida_dre_countryxs/class.ux_t3lib_pageSelect.php';
if (defined('TYPO3_MODE') &&
    $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS'][$file]
) {
     include_once $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS'][$file];
}


-- 
Mit freundlichen Grüßen
Christian Weiske

E-Mail: christian.weiske at netresearch.de

Dipl.-Inf. Christian Weiske
Netresearch GmbH & Co. KG
-----------------------------------------------
Nonnenstraße 11d - 04229 Leipzig
Telefon: (0341) 47 842 - 16
Telefax: (0341) 47 842 - 29
-----------------------------------------------
http://www.netresearch.de - info at netresearch.de

++++++++++++++
Netresearch - Spezialagentur für TYPO3 und Magento


++++++++++++++
http://www.netresearch.de/blog
http://twitter.com/netresearch

-----------------------------------------------
Registergericht:
Amtsgericht Leipzig HRA 15614

Komplementär:
Netresearch Beteiligungs GmbH, Amtsgericht Leipzig HRB 17018

Geschäftsführer:
Michael Ablass, Thomas Fleck





More information about the TYPO3-dev mailing list