Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add update hook to add pathauto pattern should it not exist yet #254. #255

Merged
merged 2 commits into from
Jan 19, 2023

Conversation

ekes
Copy link
Member

@ekes ekes commented Dec 12, 2022

To test:

  • Install version of localgov_directory_promo_page before e142ff2 so current 2.3.7 version will do.
  • Enable localgov_directory_promo_page module
  • Then switch to this branch and run updb

The pathauto pattern should be exactly the same, as installing from scratch at HEAD.

Stretch goal. Do the same with a pathauto pattern added, it shouldn't change.

@ekes ekes mentioned this pull request Dec 13, 2022
Copy link
Contributor

@andybroomfield andybroomfield left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This worked for me, testing the scenario whereby installing without the pattern and them running drush updb now adds the correct pattern.

I havn't tested the scenario whereby a pattern had been already set up, as this would only test the machine name anyway both patterns may end up present and site builders would have to sort out which one to keep.

@finnlewis
Copy link
Member

Discussing at Merge Monday. @andybroomfield pointed out that this loads the url alias pattern based on machine name.

If someone has already created a path auto pattern manually, this will currently introduce a duplicate.

We could cover this in release notes, but probably better to try to load a path auto pattern that matches on content type = directory promotional page.

@ekes thinks this is possible - just needs looking at.

@finnlewis finnlewis self-assigned this Jan 9, 2023
@ekes
Copy link
Member Author

ekes commented Jan 16, 2023

Manual testing pattern:-

Install (without this branch). Then
a) just switch to this branch and upgrade you should get the pathauto pattern;
Repeat but this time
b) create a path auto pattern machine name anything you like for the promo page; then switch to this branch and upgrade; you shouldn't get the pathauto pattern.

@finnlewis
Copy link
Member

Thanks, I will test

Copy link
Member

@finnlewis finnlewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes mate, this works a treat! Confirmed that it adds the pathauto pattern if one does not exists and a pattern is already there for the localgov_directory_promo_page, it leaves it well alone.

Nice one @ekes ! I'll merge this and prep the release for review on Monday as discussed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants