[MAGNOLIA-5053] The default TemplateAvailability value should be configurable Created: 23/May/13 Updated: 18/Mar/15 Resolved: 19/Jun/13 |
|
| Status: | Closed |
| Project: | Magnolia |
| Component/s: | rendering |
| Affects Version/s: | 4.5.8 |
| Fix Version/s: | 4.5.10, 5.0.1 |
| Type: | Improvement | Priority: | Neutral |
| Reporter: | Roman Kovařík | Assignee: | Roman Kovařík |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| 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)
|
||||||||||||||||||||
| Date of First Response: | |||||||||||||||||||||
| Description |
|
When the availability isn't defined, than the default one from info.magnolia.rendering.template.configured.ConfiguredTemplateDefinition is used: ... public ConfiguredTemplateDefinition() { this.templateAvailability = new TemplateAvailability() { @Override public boolean isAvailable(Node content, TemplateDefinition templateDefinition) { // by default a template is available only in the website workspace try { return content.getSession().getWorkspace().getName().equals("website") && StringUtils.substringAfter(templateDefinition.getId(), ":").startsWith("pages/"); } catch (RepositoryException e) { return false; } } }; } ... The default TemplateAvailability value should be configurable. |
| Comments |
| Comment by Jan Haderka [ 07/Jun/13 ] |
|
You should be able to get ConfiguredTemplateAvailability via IoC and have it just as a param in constructor w/ annotation in ConfiguredTemplateDefinition instead of explicitly requesting it from components. |