Problem/Motivation
Recipes that add on can only do so for stuff that exists at the time. So for example, the Advanced SEO recipe adds SEO fields to existing content types. If you add a new content type, there's no way to reapply the recipe via the UI to get the fields on the new content type.
Proposed resolution
Not sure yet, I am sure we could tackle this in PB but how would someone even know to look there when the recipe is already applied?
I have no answers, just capturing the question in case it isn't already captured.
Comments
Comment #2
phenaproximaThis doesn't feel in the scope of Drupal CMS specifically; moving to Project Browser.
Comment #3
pameeela commentedI disagree but I guess it depends what we mean. I’m saying I don’t think this can live only with the current PB UI. Maybe there are two issues, one for “allow reapplying recipes in PB” and another for what I’m getting at here which is the larger journey.
Comment #4
pameeela commentedAfter some discussion, moving to recipes because we will have to solve it there in some way first.
Other notes:
Comment #5
pameeela commentedComment #6
phenaproximaTo be clear...this capability is not currently a thing recipes can do, generally speaking, and it may be declined by the system maintainers because it contradicts a design decision of the recipe system, which is that recipes express strong opinions and do not make logical decisions. This concept (choose which things this recipe applies to) veers uncomfortably close to a recipe having logic, which isn't allowed because it breaks predictability and composability.
You can still do it via config actions, as long as you have a custom action which can accept a list of content types to target. (There are some examples of this pattern in core.) But it might not be accepted by the recipe system itself.
Having said that, I can see ways to accomplish this. Here's an example (although I think it would be unlikely to land in core) -- maybe you could take a recipe as a "template", and generate a temporary copy of that recipe, with some minor alterations that do cause it to be applied to only certain content types. Then the temporary recipe could be deleted after being applied.
Comment #7
pameeela commentedI probably should have said this was a discussion with Tim Plunkett and Alex Pott (in fact, I think that part was Alex's idea specifically!). We were just chatting though, in very general terms.
Comment #8
thejimbirch commentedRecipes can be re-applied on the command line, and there are even tests for it in Drupal CMS. It is Project Browser that is not allowing a recipe to be re-applied in the UI.
Since #3478332: Add a way to prevent recipes' imported config from being compared too strictly to active config landed, if we add strict: false to the Advanced SEO recipe, it should be able run even if the config it imports are changed.
Once #3481751: Opt some core recipes out of strict config comparisons lands it will be even easier for other recipes to follow suite if they rely on core recipes.
That is interesting. How are they creating a content type? On /admin/structure/types/add or in Project Browser?
Currently, the fields would be added to any content type that didn't have them. Since the existing content type has the fields, they are skipped.
Now that #3303126: Make it possible for recipes to prompt for input values has landed, we could change the recipe to ask which content types to add the fields to, all, or specific bundle machine names. But again, that is only on the command line. I searched, but couldn't find an issue where Project Browser is going to support getting input for recipes.
Comment #9
thejimbirch commentedComment #10
pameeela commentedWhen we discussed this we were thinking of /admin/structure/types/add but as you alluded to that's only one possible journey. This is a pretty complicated problem from the UX side, and my guess would be we don't solve this until a bit later since we still have to solve the input problem (and I'm sure a few others) first.
So maybe this should be postponed?
Comment #11
thejimbirch commentedMakes sense.
I was wrong. Reading the change order, it is not currently possible.