-
Notifications
You must be signed in to change notification settings - Fork 111
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
ENH: Localisation manager links available for CMS edit link capable models. #838
Conversation
Please change the commit prefix to As this is a bug fix that doesn't introduce new API, please also retarget this to the Note you may need to reset your commits after retargetting the PR. |
69ae287
to
ab28c21
Compare
I've pushed up the requested changes @GuySartorelli , please review. |
There are failing unit tests to address. |
863321a
to
83e5d76
Compare
Tests passing now @GuySartorelli , please review 🙏 . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a full review, just a few things that were jumping at me when I glance at it.
$localeTitle = Convert::raw2xml($recordLocale->getTitle()); | ||
$render = sprintf('<a href="%s" target="_top">%s</a>', $localeLink, $localeTitle); | ||
|
||
return $render; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried this with return DBField::create_field('HTMLVarchar', $render);
and that works for me locally.
When I checked out the 7.0
branch I found that that works for me as well.
Did you replicate the original issue in a fresh installation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup, tested this with vanilla install with this composer file (ran composer update just before the test): (replaced fluent folder with the one from my branch though)
{
"name": "silverstripe/installer",
"type": "silverstripe-recipe",
"description": "The SilverStripe Framework Installer",
"require": {
"php": "^8",
"silverstripe/recipe-plugin": "^2",
"silverstripe/recipe-cms": "~5.x-dev",
"silverstripe-themes/simple": "~3.2.0",
"silverstripe/login-forms": "^5",
"dnadesign/silverstripe-elemental": "^5",
"maxime-rainville/anyfield": "^0.0.0",
"silverstripe/tagfield": "^3.1",
"silverstripe-terraformers/gridfield-rich-filter-header": "dev-master",
"tractorcow/silverstripe-fluent": "^7"
},
"require-dev": {
"silverstripe/recipe-testing": "^3",
"silverstripe/graphql-devtools": "^1.0"
},
"extra": {
"resources-dir": "_resources",
"project-files-installed": [
"app/.htaccess",
"app/_config.php",
"app/_config/mimevalidator.yml",
"app/_config/mysite.yml",
"app/src/Page.php",
"app/src/PageController.php",
"behat.yml",
"phpcs.xml.dist",
"phpunit.xml.dist"
],
"public-files-installed": [
".htaccess",
"index.php",
"web.config"
]
},
"repositories": {
"ichaber/silverstripe-swiftype": {
"type": "git",
"url": "https://github.com/silverstripe-terraformers/silverstripe-swiftype.git"
}
},
"config": {
"process-timeout": 600,
"allow-plugins": {
"composer/installers": true,
"silverstripe/vendor-plugin": true,
"silverstripe/recipe-plugin": true
}
},
"prefer-stable": true,
"minimum-stability": "dev"
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's very important to note that that is not a vanilla installation - there are a lot of optional modules there which you won't get when you just do composer create-project silverstripe/installer && composer require tractorcow/silverstripe-fluent
With this set of modules I do experience the problem, but not when I just do a truly vanilla installation. I suspect one of the additional optional modules in this set is interfering with the way the value is displayed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha! It's the constraint for silverstripe/recipe-cms
here that changes things.
"silverstripe/recipe-cms": "5.1.x-dev"
works as expected without this PR
"silverstripe/recipe-cms": "~5.x-dev"
does not work as expected without this PR
Looks like there's a regression in framework or somewhere similar, and the problem should be addressed wherever that root cause regression lies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent find @GuySartorelli ❤️ . I will change this PR into enhancement only covering the part that expands the display of title links which was my original intention. I'll check if I can find the source of the regression separately.
re: #838 (comment) I'll mark this as a draft in the meantime to avoid it being merged in its current state. |
83e5d76
to
bfbdf67
Compare
This is now ready to be reviewed as a standalone enhancement @GuySartorelli |
Please retarget this to the |
Created silverstripe/silverstripe-framework#11191 to cover the malformed HTML |
bfbdf67
to
51f09c3
Compare
51f09c3
to
d426370
Compare
@GuySartorelli Updated base branch to |
Works well locally, just one suggested change above. |
I've added the requested change @GuySartorelli , please review. |
$url = Director::makeRelative($url); | ||
|
||
if ($url) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I double checked and Director::makeRelative()
returns an empty string if an empty string is passed in, so while this path is slightly different to how it used to be, it should be fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM and works as expected locally.
Merge on green
Description
Allow all CMS edit link capable models to use a Title link in the Locale manager. This link is quite handy as you can switch between locales easily. Previously this was available only for models extending
SiteTree
(pages).Pull request checklist