elementor/core
Omer Israeli aa5d448165
Internal: Editor render context for nested templated elements [ED-24339] (#36149)
Add afterSettingsResolve hook on nested templated element views, thread
currentPostId from renderContext through dynamic-transformer, and bucket
dynamic tag cache requests by editorRenderPostId using the existing
render_tags endpoint.

Ref: ED-24339

## PR Checklist
<!-- 
Please check if your PR fulfills the following requirements:
**Filling out the template is required.** Any pull request that does not
include enough information to be reviewed in a timely manner may be
closed at the maintainers' discretion.
 -->
- [ ] The commit message follows our guidelines:
https://github.com/elementor/elementor/blob/master/.github/CONTRIBUTING.md


## PR Type
What kind of change does this PR introduce?
<!-- Please check the one that applies to this PR using "x" with no
spaces eg: [x]. -->
- [ ] Bugfix
- [ ] Feature
- [ ] Code style update (formatting, local variables)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] CI related changes
- [ ] Documentation content changes
- [ ] Other... Please describe:

## Summary

This PR can be summarized in the following changelog entry:

*

## Description
An explanation of what is done in this PR

*

## Test instructions
This PR can be tested by following these steps:

*

## Quality assurance

- [ ] I have tested this code to the best of my abilities
- [ ] I have added unittests to verify the code works as intended
- [ ] Docs have been added / updated (for bug fixes / features)

Fixes #

<!--start_gitstream_placeholder-->
###  PR Description
## 1. Problem & Context

Nested templated elements in the editor canvas now need access to parent
render context (e.g., current post ID) when resolving dynamic tags. This
enables proper tag resolution across different post contexts within
nested structures.

## 2. What Changed (Where)

- **PHP (manager.php)**: Refactored access control from
`User::is_current_user_can_edit()` to new
`can_current_user_render_tags_for_post()` with fallback to post type
capabilities.
- **TypeScript (create-nested-templated-element-type.ts)**: Added
`afterSettingsResolve()` hook to process resolved settings before
caching.
- **TypeScript (create-component-type.ts)**: Enhanced
`getResolverRenderContext()` to merge parent resolver context with
component's own namespace context.
- **TypeScript (dynamic-transformer.ts)**: Threaded
`renderContext.currentPostId` through dynamic tag resolution pipeline.
- **JavaScript (manager.js)**: Restructured cache requests to bucket by
`editorRenderPostId` per tag, enabling multi-post batch renders with
per-post AJAX calls.
- **Types (types.ts)**: Removed `RefreshCacheFromServerOptions`; added
`editorRenderPostId` to `TagInstance`.
- **Tests**: Full coverage for manager bucketing and batch request
logic.

## 3. How It Works

Render context flows top-down: parent component →
`getResolverRenderContext()` → merged with child namespace → passed to
dynamic tag transformer. Tags now carry `editorRenderPostId` override;
cache layer groups pending requests by post ID, fires separate AJAX
calls per bucket, then consolidates results. `afterSettingsResolve()`
hook allows intermediate processing before hash comparison.

## 4. Risks

Post ID bucketing changes cache key generation—ensure old cached entries
don't collide with new scheme. Batch ID logic (`needsUniqueIds`) assumes
`postIds.length > 1` distinguishes parallel vs. single renders; verify
no race conditions if callbacks fire out-of-order during concurrent
requests.

_Generated by LinearB AI and added by gitStream._
<sub>AI-generated content may contain inaccuracies. Please verify before
using.
💡 **Tip:** You can customize your AI Description using **Guidelines**
[Learn
how](https://docs.gitstream.cm/automation-actions/#describe-changes)</sub>
<!--end_gitstream_placeholder-->

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: IshayMaya <47317545+IshayMaya@users.noreply.github.com>
Co-authored-by: ElementorBot <48412871+elementorbot@users.noreply.github.com>
2026-06-11 10:49:58 +03:00
..
admin Internal: Update text for CTA [ED-24386] (#36099) 2026-06-04 11:27:01 +03:00
app Internal: Fixed lint error [ED-17694] (#29800) 2025-01-07 13:33:20 +02:00
base Fix: Kit templates should not have edit with elementor links [ED-23711] (#35954) 2026-05-20 12:01:36 +03:00
behaviors/interfaces Internal: Fixed lint comments [EDS-1186] (#29747) 2025-01-02 16:20:59 +02:00
breakpoints Fix: Page can't load when using Template Widget [ED-11736] (#23473) 2023-08-20 10:26:24 +00:00
common Internal: Improve Editor activity handling [ED-24415] (#36127) 2026-06-08 07:55:25 +00:00
database Internal: Add v4 related features capabilities [ED-19080] (#31027) 2025-05-08 12:23:14 +03:00
debug Internal: Fixed lint comments [EDS-1186] (#29747) 2025-01-02 16:20:59 +02:00
document-types Internal: Update php coding standard rules - FunctionComment [ED-20572] (#32425) 2025-09-02 14:06:32 +03:00
dynamic-tags Internal: Editor render context for nested templated elements [ED-24339] (#36149) 2026-06-11 10:49:58 +03:00
editor Internal: Update popup logic [ED-24301] 2026-06-04 01:17:08 +03:00
experiments Internal: Improve popup display rules. [ED-24353] (#36156) 2026-06-10 15:33:27 +00:00
files Fix: Saving AI generated images into Media [ED-23530] (#35284) 2026-03-25 15:34:28 +00:00
frontend Internal: Update should_optimize_controls logic for API requests (#34016) 2025-12-31 13:21:41 +00:00
isolation Internal: Essential to Advance > Plugin Home header [ED-16756] (#30274) 2025-02-19 13:56:47 +02:00
kits Fix: Import kit: Fix global classes legacy import format [ED-24027] (#35789) 2026-05-11 12:10:47 +00:00
logger Internal: Remove deprecated constant [ED-21787] (#33606) 2025-11-25 18:39:14 +04:00
page-assets Internal: Fix ParamNameNoMatch PHP lint issue[ED-17725] (#29838) 2025-01-09 16:24:51 +02:00
responsive Internal: Fixed lint error [ED-17694] (#29794) 2025-01-06 15:27:45 +02:00
role-manager Internal: Remove editor one experiment [ED-22438] (#34384) 2026-01-23 14:28:54 +02:00
settings Internal: Update php coding standard rules - FunctionComment [ED-20572] (#32425) 2025-09-02 14:06:32 +03:00
upgrade Revert "Internal: Remove nested-elements experiment [ED-20667]" (#34137) 2026-01-07 16:55:34 +00:00
utils Internal: Improve popup display rules. [ED-24353] (#36156) 2026-06-10 15:33:27 +00:00
documents-manager.php Fix: Display drafts of nested documents in preview [ED-22213] (#34099) 2026-01-06 16:08:42 +02:00
modules-manager.php Internal: Assets lazy-loading [ED-23813] (#35791) 2026-06-02 09:31:27 +00:00
wp-api.php Fix: Call to undefined function get_plugins() (#29154) 2024-11-01 09:07:44 +02:00