localgov
localgov copied to clipboard
Added LocalGov Preview Link module
This PR adds a new module that makes it easy for content editors to add all pages in a guide or step by step to a preview link.
The module adds a new button that will auto-populate the entities on a preview link page.
Part of #600
@Adnan-cds @andybroomfield @ekes @finnlewis @and anyone else.
I'm not sure this is the best way to add the achieve this, so your thoughts are welcome.
What we want to achieve here is an easy way to add all guides, step by steps and subsite pages to the preview link entities list.
The approach I've taken is to put all the code to find the entities into a new module in the profile. It would be cleaner and possibly more extensible if each module supplied it's own logic to say whether adding multiple entities like this is supported and, if so, supply the logic to get all the related entities.
I suspect the Drupal way to do this is through a plugin system, but this seems overkill to me. But maybe not?
Thoughts?
Nice, thanks @stephen-cox. I'd condider making this a seperate module and not limiting it to the profile, as it's likley to have utility in other cases and not all LGD sites install via the localgov install profile. (Profile modules can't AFAIK be used outside the profile).
Discussing in Merge Tuesday meeting with @ekes :
It would be good to include this somewhere other than the profile.
The main arguments for not putting it in the profile:
- some people don't use the profile
- profiles will probably be deprecated soon in favour of recipes
- profiles can now be uninstalled https://www.drupal.org/node/3432357
So maybe we should move this sub-module to localgov_core (if we assume everyone wants it), or have it as a separate project (if it is useful as a standalone project).
Discussing at Merge Tuesday with @stephen-cox :
- Relatively straight forward to add this to the https://www.drupal.org/project/preview_link module as a plugin and service
- We can then implement the plugins in our modules.
- Estimating around 10 hours to get it all done
I think that sounds like a great direction of travel!
Closing this as there's now an MR adding this functionality to the Preview Link module: https://git.drupalcode.org/project/preview_link/-/merge_requests/28