feat(templates): Expose row flags for menu, page, crumbs - #29
Merged
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #29 +/- ##
============================================
+ Coverage 20.74% 26.66% +5.91%
+ Complexity 1171 1165 -6
============================================
Files 15 18 +3
Lines 2964 3011 +47
============================================
+ Hits 615 803 +188
+ Misses 2349 2208 -141 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
One tpl can branch on isActive/hasChildren instead of many tpl* chunks. Specialized templates stay. Menu state drives classes, tpl pick, and placeholders from the same facts. Fixes #11
Drop CrumbItemState and pageItemTplAndFlags; keep flags in Paginator and snippet layers; freeze menu config on MenuItemState; fix category-at-0.
Harnesses capture getChunk so makePageLink/renderPageItem and templateBranch flag merges are asserted without a live MODX install.
Ibochkarev
force-pushed
the
feat/template-item-flags
branch
from
September 2, 2026 07:02
e5ced08 to
9c73f19
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
pdoMenu, pdoPage, and pdoCrumbs put boolean placeholders on each template row so one chunk can replace a stack of specialized
tpl*files.Values are
1or0for Fenom{if $isActive}and MODX[[+isActive]].Shared:
isFirst,isLast,isActive. Menu also:hasChildren/hasChilds,isHere,isStart,isCategory,isInner. Page also:isSkip. Crumbs also:isHome.Existing
tplHere,tplParentRowActive,tplPageActive,tplCurrent, and the rest still win when set. Flags are always present either way.Menu example:
Why
Without these flags you need separate chunks for current, parent, first, empty first/last page, and so on. The state was already computed for CSS classes and tpl selection; it was not exposed to the template.
Fixes #11