We are creating a new structure of project to extend the components from a Shared project which we have created.
Talking about the extend components, we used the same solutions about extend the Adobe Core Components.
However, we also need to extend the components policies, as the follow example:
- We have an App Container, which has a policy to accept ONLY an App Item that is another component.
We tried a "manually" mode which was repeat the path from shared project to my new project and it worked. However, we would not like to make this "dependency" to adjust in every new project that configurations in a manual mode.
We expected for the simple solution which is: In my new project, I create a new policy and links to the path from the shared project and extends all the policy components created in the Shared Project. As a new policty is created in Shared Project, all of my "New Projects" are updated from this new policy
Your description makes no sense. Components do NOT have policies. An Editable template have policies that Define what components are allowed to be used within a page that is based on an editable template.
Also please point to AEM documentation that describes what you refer to as an App Container. This phrase means nothing in terms of editable templates.
"component policies" - Policies are note defined at the component-level but are assigned to components at the template-level, so I'm a bit confused.
Answer: We know that the policies are not defined at the component-level, they are assigned at the template level.
Its exactly the point, I created a new template and I would like to extend the Policies from another template to my new template.
"App Container" - Is this a Layout Container that accepts only one component called "App Item"? Or is "App Container" also a custom component?
Its just a example about the problem, but forget because it's too much specific about a component that we have created
To clarify the problem, Im gonna try to explain with another generic words:
We are trying to create a catalog of components in a project that we called by "Shared Components". In that project, we are adding some components and some templates. Our necessity is described about reuse the components and create new projects faster changing only the basic colors from the components.
Imagine that we create a new project and we want to use some component from my Catalog Of Components which are placed in "Shared Components" project. So, we extend that component using the ResourceSuperType and include, we have a component reusable. Until this moment, we are very happy about that possibility to my Catalog of Components.
Following the sample above, we create a new template on my new project, and inside in that template, we would like to EXTEND all the POLICIES from the template which is in a "Shared Components" template.
So, our main problem in: Can we extend some template's policy to another templates?
No, unfortunately what you want to do is not possible.
If you observe the node structure of your template policy definitions, you can see how the existing design of template policies makes extending them impossible. In order to illustrate my example, I have created a demonstration based on the popular WKND tutorial.
Here you can see the node structure of my templates and policies:
1. This is the /conf/wknd folder
2. This is where my templates are defined
3. This is where my policies are defined
4. This is where my policies from 3 attributed to the components in my template
It is important to understand the difference between the definition of a policy and the attribution of that policy to a component within a template. Here is an example:
In this screenshot we can see that A is the attribution of the policy and B is the actual definition of that policy. If we look at the properties of A we see that it points to B:
As you can see, the path that points to B is relative. If we put the absolute path of that same policy, it will not work because policies are scoped to a project. It is not possible for a template in one project to reference a policy in the other 😕
What you can do is create a Template type. It won't allow you to change a policy in one place and see the changes reflected in your other projects, but it will save you the effort of having to recreate similar or even identical policy sets for many templates.