[MAGNOLIA-2669] <cms:out inherit="true" fails Created: 24/Mar/09 Updated: 23/Jan/13 Resolved: 07/Aug/09 |
|
| Status: | Closed |
| Project: | Magnolia |
| Component/s: | templating |
| Affects Version/s: | 4.0.1 |
| Fix Version/s: | 4.0.3, 4.1.1 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Oliver Knorr | Assignee: | Jan Haderka |
| Resolution: | Fixed | Votes: | 2 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Windows Vista Business SP1 |
||
| Attachments: |
|
||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||
| Template: |
|
||||||||||||||||||||
| Acceptance criteria: |
Empty
|
||||||||||||||||||||
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||||||||||||||||||
| Bug DoR: |
[ ]*
Steps to reproduce, expected, and actual results filled
[ ]*
Affected version filled
|
||||||||||||||||||||
| Date of First Response: | |||||||||||||||||||||
| Description |
|
After upgrading from Magnolia 3.6.3 to 4.0.1, cms:out-Tags stopped printing values inherited from parent pages. For example: <cms:out nodeDataName="copyright" inherit="true" /> prints something only, if the copyright-field is filled for the page, but no longer if it is filled only for the parent page. Some debugging showed a different code path in BaseContentTag.resolveNode() because of different results from Resource.getLocalContentNode(). This seems to be caused by the changes for |
| Comments |
| Comment by Tom Wespi [ 24/Mar/09 ] |
|
if the inherited value is not stored in a contentNodeCollectionName, you have to pass the empty attribute. <cms:out nodeDataName="metaDescription" inherit="true" var="metaDescription" contentNodeCollectionName=""/> this is working for me. |
| Comment by Oliver Knorr [ 24/Mar/09 ] |
|
Thanks a lot Tom for the suggestion, it also works for me. I have reduced the priority to minor. However, I don't think this empty attribute should be necessary, this is only a workaround. |
| Comment by Will Scheidegger [ 21/Jul/09 ] |
|
At least for tags outside of a content node iterator the problem actually seems to be related to the way how the deprecated Resource class works now. Resource.getLocalContentNode() simply returns AggregationState.getCurrentContent() which is always set to the local content node OR the current active page if one is not inside a content node iterator. Therefore the resolveNode() method of the BaseContentTag class always thinks that the tag is inside a content node iterator and therefore does not work properly. Simply comparing the handle of the local contente node returned by the Resource class with the active current page fixes this problem. Since this is a hack and not really a fix I did not provide a patch but here are the first few lines of my modified BaseContentTag.resolveNode() methode if you need a quick fix: protected Content resolveNode(Content currentPage) { Content currentParagraph = Resource.getLocalContentNode(); if (currentParagraph != null && currentParagraph.getHandle().equals(Resource.getCurrentActivePage().getHandle())) { currentParagraph = null; } //... rest of the method } |
| Comment by Magnolia International [ 21/Jul/09 ] |
|
can you please provide patches in patch form ? |
| Comment by Will Scheidegger [ 21/Jul/09 ] |
|
Grégory As I said in my comment above, I could provide a this fix as patch, but won't because it's a quick hack which still makes use of the Resource class. Once I got the new AggregationState figured out properly, I will be happy to provide a patch. |
| Comment by Will Scheidegger [ 21/Jul/09 ] |
|
This to some degree less ugly hack (Attachement 1 above) fixes the inherit problem on the cms:out tag (most likely on all tags extending BaseContentTag). Still to improve: The patch still uses the deprecated Resource class because one test failed when I tried to use MgnlContext.getAggregationState().getMainContent() instead of Resource.getCurrentActivePage(). |
| Comment by Oliver Knorr [ 21/Jul/09 ] |
|
Dear Will and Grégory, |
| Comment by Jan Haderka [ 07/Aug/09 ] |
|
Applied with few modifications and fixed tests. Thanks for patches. |