This patch fixes the newly introduced error, but doesn't address the issues of not being able to deselect a story or the hardcoded field name.
paulmartin84 → created an issue.
This has broken the shorthand module completely and stories can no longer be selected.
if (option.value == 0) {
was changed to:
if (option.value === 0) {
However the zero is actually a string so now it fails to be excluded and then causes the following error
TypeError: Cannot read properties of undefined (reading 'description'), so either need to be changed back or changed to === '0'
While this part is being addressed, we shouldn't be excluding zero anyway. Once a story has been selected, there is currently no way to unselect all stories and set it back to 0 The field doesn't have to be set as a a required nor should it have to be be.
The code also has a hardcoded field name in it, which is just not acceptable in a Drupal module. Users should be free to name their fields as they wish.
I'll create a new issue for all of the above, but just putting it here, incase people are wondering why this issue has broken something
Hopefully this is the final change, I have noticed that URLs containing percentage encoded characters are getting double encoded.
The final solution isn't that clean, but not sure much else can be done.
I have spotted another issue with the above parsing method. URLs that contain multiple query strings will have & instead of &.
Accoring to https://www.drupal.org/project/entity_embed/issues/2973178 → this is correct.
This causes parse_url not to work correctly, so I have added decoding and re-encoding the url to work around this.
Sorry I made a small mistake in the last patch, This is correct now
The attached patch fixes the query string issue mentioned in #8 and also handles a url fragment should it exist.
I've spotted an issue with the above fix, I've opened a separate issue here
https://www.drupal.org/project/tmgmt/issues/3370882
🐛
Paragraphs translations aren't always updated
Fixed
Basically the above is calling $target_entity->needsSave();
which is a getter rather than a setter, I believe it should be calling $target_entity->setNeedsSave(TRUE);
paulmartin84 → created an issue.