public function getListOfAvailableFiltersForTCA(&$config)
    {

        // get current pid
        if ($config['table'] == 'pages') {
            $currentPid = $config['row']['uid'];
        } else {
            $currentPid = $config['row']['pid'];
        }

        // get the page TSconfig
        $pageTSconfig = BackendUtility::GetPagesTSconfig($currentPid);
        $modTSconfig = $pageTSconfig['tx_kesearch.'];

        // get filters
        $fields = '*';
        $table = 'tx_kesearch_filters';

        $queryBuilder = Db::getQueryBuilder('tx_kesearch_filters');

        // storage pid for filter options
        if (!empty($modTSconfig['filterStorage'])) {
            // storage pid is set in page ts config
            $where = $queryBuilder->expr()->in(
                'pid',
                $modTSconfig['filterStorage']
            );
        } else {
            // no storage pid set in page ts config
            $where = null;
        }

        $res = $queryBuilder
            ->select($fields)
            ->from($table)
            ->where($where)
            ->execute();

        $count = $res->rowCount();
        if ($count) {
            while ($row = $res->fetch()) {
                if (!empty($row['options'])) {
                    $queryBuilder = Db::getQueryBuilder('tx_kesearch_filteroptions');
                    $optionsFields = '*';
                    $optionsTable = 'tx_kesearch_filteroptions';
                    $optionsWhere = $queryBuilder->expr()->in('uid', $row['options']);
                    $options = $queryBuilder
                        ->select($optionsFields)
                        ->from($optionsTable)
                        ->where($optionsWhere)
                        ->execute();

                    while ($optionRow = $options->fetch()) {
                        $config['items'][] = array($row['title'] . ': ' . $optionRow['title'], $optionRow['uid']);
                    }
                }
            }
        }
    }
public function getListOfAvailableFiltersForTCA(&$config)
    {

        // get current pid
        if ($config['table'] == 'pages') {
            $currentPid = $config['row']['uid'];
        } else {
            $currentPid = $config['row']['pid'];
        }

        // get the page TSconfig
        $pageTSconfig = BackendUtility::GetPagesTSconfig($currentPid);
        $modTSconfig = $pageTSconfig['tx_kesearch.'];

        // get filters
        $fields = '*';
        $table = 'tx_kesearch_filters';

        $queryBuilder = Db::getQueryBuilder('tx_kesearch_filters');

        // storage pid for filter options
        if (!empty($modTSconfig['filterStorage'])) {
            // storage pid is set in page ts config
            $where = $queryBuilder->expr()->in(
                'pid',
                $modTSconfig['filterStorage']
            );
        } else {
            // no storage pid set in page ts config
            $where = null;
        }

        $res = $queryBuilder
            ->select($fields)
            ->from($table)
            ->where($where)
            ->execute();

        $count = $res->rowCount();
        if ($count) {
            while ($row = $res->fetch()) {
                if (!empty($row['options'])) {
                    $queryBuilder = Db::getQueryBuilder('tx_kesearch_filteroptions');
                    $optionsFields = '*';
                    $optionsTable = 'tx_kesearch_filteroptions';
                    $optionsWhere = $queryBuilder->expr()->in('uid', $row['options']);
                    $options = $queryBuilder
                        ->select($optionsFields)
                        ->from($optionsTable)
                        ->where($optionsWhere)
                        ->execute();

                    while ($optionRow = $options->fetch()) {
                        $config['items'][] = array($row['title'] . ': ' . $optionRow['title'], $optionRow['uid']);
                    }
                }
            }
        }
    }
public function getListOfAvailableFiltersForTCA ( & $ config ) { // get current pid if ( $ config [ 'table' ] == 'pages' ) { $ currentPid = $ config [ 'row' ] [ 'uid' ] ; } else { $ currentPid = $ config [ 'row' ] [ 'pid' ] ; } // get the page TSconfig $ pageTSconfig = BackendUtility :: GetPagesTSconfig ( $ currentPid ) ; $ modTSconfig = $ pageTSconfig [ 'tx_kesearch.' ] ; // get filters $ fields = '*' ; $ table = 'tx_kesearch_filters' ; $ queryBuilder = Db :: getQueryBuilder ( 'tx_kesearch_filters' ) ; // storage pid for filter options if ( ! empty ( $ modTSconfig [ 'filterStorage' ] ) ) { // storage pid is set in page ts config $ where = $ queryBuilder -> expr ( ) -> in ( 'pid' , $ modTSconfig [ 'filterStorage' ] ) ; } else { // no storage pid set in page ts config $ where = null ; } $ res = $ queryBuilder -> select ( $ fields ) -> from ( $ table ) -> where ( $ where ) -> execute ( ) ; $ count = $ res -> rowCount ( ) ; if ( $ count ) { while ( $ row = $ res -> fetch ( ) ) { if ( ! empty ( $ row [ 'options' ] ) ) { $ queryBuilder = Db :: getQueryBuilder ( 'tx_kesearch_filteroptions' ) ; $ optionsFields = '*' ; $ optionsTable = 'tx_kesearch_filteroptions' ; $ optionsWhere = $ queryBuilder -> expr ( ) -> in ( 'uid' , $ row [ 'options' ] ) ; $ options = $ queryBuilder -> select ( $ optionsFields ) -> from ( $ optionsTable ) -> where ( $ optionsWhere ) -> execute ( ) ; while ( $ optionRow = $ options -> fetch ( ) ) { $ config [ 'items' ] [ ] = array ( $ row [ 'title' ] . ': ' . $ optionRow [ 'title' ] , $ optionRow [ 'uid' ] ) ; } } } } }
compiles the list of available filter options in order to display them in the page record
in the backend, so that the editor can assign a tag to a page
@param $config
compiles the list of available filter options in order to display them in the page record in the backend so that the editor can assign a tag to a page