Story #88348

Respect visibility aspect in QueryBuilder

Added by Stefan Froemken 2 months ago. Updated 2 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Database API (Doctrine DBAL)
Target version:
-
Start date:
2019-05-14
Due date:
% Done:

0%

TYPO3 Version:
9
PHP Version:
7.2
Tags:
Sprint Focus:

Description

Hello Core-Team,

I'm using extbase with my own Query based on Doctrine QueryBuilder.
If config.admPanel is activated and checkbox showHiddenRecords is set, hidden records will not be shown in frontend.

Is it my job to implement correct handling of showHiddenRecords or is it a missing feature somewhere in the DefaultRestrictionContainer?

Stefan


Related issues

Related to TYPO3 Core - Bug #86653: Preview of page, with "show", not working when starttime is set Under Review 2018-10-14

History

#1 Updated by Stefan Froemken 2 months ago

My current solution:

    /**
     * Working with own QueryBuilder queries does not respect showHiddenContent settings of TYPO3, that's why
     * we have to manually remove Hidden constraint from restriction container.
     *
     * @param QueryBuilder $queryBuilder
     */
    public function addVisibilityConstraintToQuery(QueryBuilder $queryBuilder)
    {
        if (version_compare(TYPO3_branch, '9.4', '>=')) {
            $context = GeneralUtility::makeInstance(Context::class);
            $showHiddenRecords = (bool)$context->getPropertyFromAspect(
                'visibility',
                'includeHiddenContent',
                false
            );
        } else {
            $showHiddenRecords = (bool)$this->getTypoScriptFrontendController()->showHiddenRecords;
        }

        if ($showHiddenRecords) {
            $queryBuilder->getRestrictions()->removeByType(HiddenRestriction::class);
        }
    }

#2 Updated by Georg Ringer 2 months ago

  • Related to Bug #86653: Preview of page, with "show", not working when starttime is set added

Also available in: Atom PDF