Issue Bug Closed

#54843SuggestElement: support for PAGE_TSCONFIG_*-values in addWhere

Julian Hofmann 01/08/14, 16:30 updated 10/02/18, 12:07

Description

Using PAGE_TSCONFIG_*-values in the foreign_table_where-clause will limit the entries. In combination with using a suggest wizard this doesn’t work. So at the moment you have the choice to
  • not limiting the entries in the selectbox but to limit it in the suggest wizard
  • limiting the entries in the selectbox but no results in the suggest wizard (due to an replaced marker)

In there any reason why only THIS_UID and CURRENT_PID are replaced?

if (isset($config['addWhere'])) {
    $config['addWhere'] = strtr(
        ' ' . $config['addWhere'],
        array(
            '###THIS_UID###' => intval($uid),
            '###CURRENT_PID###' => intval($pageId),
        )
    );
}

This would fix it:

if (isset($config['addWhere'])) {
    $config['addWhere'] = strtr(' ' . $config['addWhere'], 
        array(
            '###THIS_UID###' => intval($uid),
            '###CURRENT_PID###' => intval($pageId),
            '###PAGE_TSCONFIG_ID###' => intval($TSconfig['TCEFORM.'][$table . '.'][$field . '.']['PAGE_TSCONFIG_ID']),
            '###PAGE_TSCONFIG_IDLIST###' => $GLOBALS['TYPO3_DB']->cleanIntList($TSconfig['TCEFORM.'][$table . '.'][$field . '.']['PAGE_TSCONFIG_IDLIST']),
            '###PAGE_TSCONFIG_STR###' => $GLOBALS['TYPO3_DB']->quoteStr($TSconfig['TCEFORM.'][$table . '.'][$field . '.']['PAGE_TSCONFIG_STR'], $fieldConfig['foreign_table']), 
        )
    );
}

Reviews 2