-
Notifications
You must be signed in to change notification settings - Fork 13
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
SlugModifier ignores unsaved record data received through XHR #33
Comments
Yes, that's a real problem . Our editors complain that the slug changes only on the second save after changing the page title. |
… pieces This fixes b13#33 by applying to the loaded record array with the incoming record fields. Also apply string casting to the slug pieces to avoid fatal error when some other hook sets a record field as something else than string, e.g. integer.
This fixes b13#33 by applying array_replace to the loaded record array with the incoming record fields. Also apply string casting to the slug pieces to avoid fatal error when some other hook sets a record field as something else than string, e.g. integer.
Yep, absolutely crucial. Created a PR for this, as it blocks our v11 upgrade at the moment. |
Hi, SlugModifier.php is still:
and not:
At least when I look here: https://extensions.typo3.org/extension/download/masi/2.0.2/zip When I check here, it's fine: https://github.com/b13/masi/blob/master/Classes/SlugModifier.php Mhhhh... I don't understand... |
Version 2.0.2 is from November and does NOT contain this patch. Version 2.0.3 is from December and DOES contain this patch. Your dependency is outdated; you will need to update to 2.0.3. |
ahhhh! But there is no 2.0.3 in TYPO3 TER? right? |
No, doesn't look like there is. You'd have to ask the maintainers why - my guess is an expired TER token prevented the automatic TER upload. But I definitely recommend using composer and only composer ;) |
"But I definitely recommend using composer and only composer ;)" Yes, but we can't change this on a running project... next update... :) |
When changing the page title and regenerating the page slug, the SlugModifier checks if the record was already saved (has uid) and if it does, it attempts to load the record from DB. SlugModifier receives
$record
which contains the record data in current unsaved state, but replaces this array entirely with data from the DB. The result is that any unsaved record value is completely ignored by SlugModifier.Compare the behavior with and without EXT:masi:
It's possible that simply changing this line:
https://github.com/b13/masi/blob/master/Classes/SlugModifier.php#L95
From:
$this->recordData = $row;
To:
$this->recordData = array_replace($row, $this->recordData);
...would yield the correct combination of every column from DB, with values from unsaved fields in XHR overriding already persisted values in DB.
The text was updated successfully, but these errors were encountered: