Skip to content

[FEATURE] Add nonglobal tag scoping via TYPO3 feature flag#8

Merged
srosskopf merged 5 commits into
masterfrom
feature/nonglobal-tags-feature-flag
Mar 16, 2026
Merged

[FEATURE] Add nonglobal tag scoping via TYPO3 feature flag#8
srosskopf merged 5 commits into
masterfrom
feature/nonglobal-tags-feature-flag

Conversation

@teneris
Copy link
Copy Markdown
Contributor

@teneris teneris commented Mar 10, 2026

Summary

Integrates the feature/nonglobal-tags changes into master behind a TYPO3 system feature flag, making the behaviour opt-in per installation.

Feature flag

// AdditionalConfiguration.php
$GLOBALS['TYPO3_CONF_VARS']['SYS']['features']['pagebased.nonglobalTags'] = true;

Also available via the Install Tool → Admin Tools → Features.

Behaviour

Flag state TagUtility::getTags() behaviour
OFF (default) Existing global behaviour — all tags across all categories
ON, category already set on demand Category-scoped as usual, rootline detection skipped
ON, no category on demand, category page found in rootline Demand auto-scoped to the rootline category
ON, no category on demand, no category page in rootline Returns null — no tag dump

Changes

  • ext_localconf.php — registers the feature flag (default: false)
  • Classes/Utility/TagUtility.php — wraps rootline detection in the flag guard; also fixes a bug from the feature branch where the category doktype was hardcoded as 93 instead of using RegistrationService::getRegistrationByCategoryDocumentType()
  • Tests/Functional/Utility/TagUtilityTest.php — 4 functional tests covering all flag states
  • Tests/Functional/Fixtures/Database/pages_tags.csv — fixture with two categories and tagged objects

René and others added 4 commits July 30, 2025 12:58
…he current object space

Feature for #69964
Introduce the pagebased.nonglobalTags feature flag (off by default).
When enabled, TagUtility::getTags() auto-detects the current blog
category from the rootline and scopes tag queries to that category.
Returns null if no registered category page is found, preventing a
global tag dump. Skips detection when category is already set on demand.

The findTagStrings/collectTagsFromStrings optimisation path is preserved
and active regardless of flag state.

Also fixes a bug from the feature branch: the rootline lookup now uses
RegistrationService::getRegistrationByCategoryDocumentType() instead of
a hardcoded doktype value.

Enable per installation in AdditionalConfiguration.php:
  $GLOBALS['TYPO3_CONF_VARS']['SYS']['features']['pagebased.nonglobalTags'] = true;
Copilot AI review requested due to automatic review settings March 10, 2026 12:06
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds opt-in (feature-flagged) non-global tag scoping so TagUtility::getTags() can restrict tag results to the category found in the current page’s rootline, while preserving the existing global behavior by default.

Changes:

  • Register new TYPO3 feature flag pagebased.nonglobalTags (default false).
  • Update TagUtility::getTags() to conditionally auto-scope demands to a rootline category (or return null when none is found).
  • Add functional tests + CSV fixtures covering flag on/off scenarios and rootline resolution cases.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
ext_localconf.php Introduces the feature flag configuration default (false).
Classes/Utility/TagUtility.php Guards rootline/category auto-detection behind the feature flag and scopes/short-circuits tag results accordingly.
Tests/Functional/Utility/TagUtilityTest.php Adds functional coverage for all described flag behaviors (global vs scoped vs null).
Tests/Functional/Fixtures/Database/pages_tags.csv Adds fixture data with two categories and tagged objects to validate scoping behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Classes/Utility/TagUtility.php Outdated
Comment thread Classes/Utility/TagUtility.php Outdated
Comment thread Tests/Functional/Utility/TagUtilityTest.php
- Scope rootline category lookup to the repository's own registration
  doktype to avoid cross-registration matches in multi-registration
  installations; falls back to any registered doktype when registration
  cannot be resolved.
- Rename $blogCategoryUid to $categoryUid and remove 'blog' wording
  from inline comments – TagUtility is generic, not blog-specific.
- Add comment in tearDown() explaining why setAccessible(true) is
  intentionally absent (no-op / deprecated since PHP 8.1).
@teneris teneris requested a review from rmue11er March 10, 2026 12:38
Copy link
Copy Markdown

@rmue11er rmue11er left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

passt

@srosskopf srosskopf merged commit bc69822 into master Mar 16, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants