Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
image system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
9 Feb 2012 at 06:28 UTC
Updated:
5 Dec 2014 at 11:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
larowlanComment #2
larowlanPatch adds link to formatter settings form.
Note this introduces a new string so can't be backported.
The existing string is 'Image styles' so I don't think that provides enough context. Happy to swap it out for something existing if it can be found.
Comment #3
larowlanComment #4
webbykat commentedThat patch worked beautifully for me, minus a Git warning: "1 line adds whitespace errors" (looks like line 9).
Comment #5
webbykat commentedUpdated patch without the whitespace that was causing the error.
Comment #6
SuperHeron commentedThat patch seems OK. However, when I want to go back to field display settings page, I have to click twice on the "Back" button of my browser. Clicking once should be enough.
Comment #7
yurtboy commentedWould that be an Overlay issue?
I tested the patch and SuperHeron's comments on the click back and it is confusing but not sure if this patch can "fix" that?
Plus isn't the back button suppose to go away? ( -:
Comment #8
draganerorPatch from #5 works perfectly.
"Go back" button also works if Overlay is disabled.
Comment #9
catchWhat's wrong with user_access()? Also for altering it's generally better to assign #access to the form element rather than conditionally defining it.
Comment #10
yoroy commentedNice patch! I think we don't use the 'manage' word that much, probably more consistent to say 'Configure image styles'.
Comment #11
jaffaralia commentedi changed the word manage to configure as mentioned in 10
Comment #13
jaffaralia commented#11: 1433796-manage-image-styles-10.patch queued for re-testing.
Comment #15
nmudgal commentedPlease find the attached patch as per comment #9 and #10.
Thanks.
Comment #16
claudiu.cristea#15: 1433796-configure-image-styles-10.patch queued for re-testing.
Comment #17
gitesh.koli commentedI am going to try to rework this patch for the latest version of d8.
Comment #18
gitesh.koli commentedPatch File attached.
Comment #20
gitesh.koli commented18: 1433796-configure-image-styles-11.patch queued for re-testing.
Comment #22
gitesh.koli commentedComment #23
gitesh.koli commentedComment #24
gitesh.koli commentedComment #26
gitesh.koli commentedComment #27
jfrederick commentedI changed the capitalization of the link while also translating it. Also, converted it to use dependency injection. All of this during the Austin sprint.
Comment #28
opratr commentedPatch looks like it works. Link is where it's expected an takes user to expected destination. Screen shot attached.
Changed status to RTBC
Comment #29
opratr commentedGot out of sync with #27. Will review again.
Comment #30
joshi.rohit100Updated as Drupal 8 Apis changed.
Please review now.
Comment #31
claudiu.cristeaThank you.-
-
Don't you think that this needs to go just below the "Image style" select as it's referring to that element?
Please add an empty line before
returnstatement. Also between each form element as is now.Comment #32
joshi.rohit100updated patch as #31. Please review now.
Comment #33
claudiu.cristeaThank you.
Trailing spaces at the end of lines. Remove them.
There's no need for empty line here while
$link_typesis together with the next element.Also please publish every time an interdiff, otherwise is hard to track changes.
Comment #35
joshi.rohit100Updated patch as #33
Comment #36
claudiu.cristeaGood to go for me.
Comment #37
alexpottWe seem to have lost the dependency injection fro #27 why?
Also shouldn't we only be adding the link if the user has the administer image styles permission?
Comment #38
claudiu.cristeaAdded back the dependency injection but cleaned up and re-adapted the constructor signature.
Comment #39
claudiu.cristeaComment #40
claudiu.cristeaComment #41
fietserwinI agree with #37, 2nd remark: add an #access property to the form item.
And a small doc error:
Constructs an ImageFormatter object.
Comment #42
claudiu.cristeaAh, I missed that from #37.
Comment #43
fietserwinI'm fine with the patch now. However, I see that e.g. CommentForm (core\modules\comment\src\CommentForm.php) injects the current user (whereas NodeForm (core\modules\node\src\NodeForm.php) does not. As we tend to use injection in OO code and try to reserve Drupal:: for procedural code only, I think it would be just a bit better to inject the current user here as well.
What do you think?
Comment #44
claudiu.cristeaHa, ha :) I only checked NodeForm and decided to go in that way. But I agree that injection is better.
Will rework the patch.
Comment #45
undertext commentedComment #46
fietserwinComplete the documentation for the constructor by adding:
After that the patch is OK.
(Note: PhpStorm warns you for these omissions, you may apply for a free license for open source development)
Comment #47
claudiu.cristeaAnd please add an interdiff.txt against #42.
Comment #48
claudiu.cristeaComment #49
claudiu.cristeaComment #50
claudiu.cristeaComment #51
fietserwinBesides reviewing, I also tested locally that the access check indeed works: RTBC
Comment #52
alexpottWe should be testing this - otherwise we could potentially break this.
Comment #53
undertext commentedTrying to cover this in tests.
Comment #54
fietserwinThanks for adding a test. A few questions arise though:
- Should we use assertLink(), assertLinkByHref() (my preference) or both?
- Should we test the negative case of the #access part (I think so)?
Leaving to NR to get more opinions on this, but feel free to make a new patch conforming to your (or mine) view on this.
Comment #55
m1r1k commentedComment #58
eporama commentedTaking at look at this at NERDSummit2014
Comment #59
hampercm commentedTaking over from eporama
Comment #60
hampercm commentedRerolled patch from #53 against 8.0.x
Comment #61
fietserwinMy remarks from #54 are still standing. with those 2 changes I will RTBC.
Comment #62
hampercm commentedComment #63
yoroy commentedI still very much like this patch. Adding a fresh screengrab, the one in #48 shows it in a different place than it is now:
I think it would be even better if we put the link next to the select list. It makes this link slightly less prominent by taking it out of it's own line, removing it from the top to bottom flow. Slightly less prominent is good here because you won't need this link most of the time. It's not the same as the link for editing the machine name of things, but ginving this link the same amount of prominence here seems right:
Can somebody reply to the questions in #54?
Comment #64
fietserwin#63: Good idea, seems like a nice improvement to me.
- Perhaps with brackets around, or is that not international enough, i.e. do brackets have to be translated and is that worth the hassle?
- If it is done in css, assure that RTL languages keep working.
- Open in new tab or do we never do that? I'm normally opposed to this as the user can force this him/herself, but in this case the user may loose (a lot of) changes by (unintentionally) clicking on this link. OTOH, any new styles won't show when returning to this tab.
Comment #65
yoroy commented- I don't the brackets are necessary here, I think they were added to the machine name pattern to illustrate that this value is a "synonym" for the value in the text field before it.
- yup
- We never force a link to open in a new tab, but you bring up an important point. That any new image styles won't show up is enough reason to not open in a new tab, but we should also prevent losing unsaved changes. AFAIK that risk is already there (you'll lose changes to individual field settings if you don't save on the whole content type) and I think there's already an issue open about that. Maybe this is a case where you'd want the image styles ui to show up in a modal window, but then still only if a new image style will become available once you exit that modal. Hmmm.
Comment #66
Bojhan commentedI am not sure if we should worry about it too much. Unlike other settings, clicking away here - although destructive is only a minor inconvenience. As its likely 3/4 settings.
Ideally we have some form of localstorage here, just like we do with views. But realistically we can probably just get away with the fact that people lose data, since its relatively easy to recover. I am not sure if it makes much sense to introduce a one-off pattern, for that inconvenience.
Comment #67
yoroy commentedThanks, that sounds like the right trade off to me as well.
Comment #68
fietserwinI agree, as well, I just wanted to raise the options. So, a new patch should add #63 and #54 and it's OK.
Comment #69
hampercm commentedThe patch from #60 was causing a PHP error when I browsed to /admin/structure/types/manage/article/display: it looks like the second parameter of LinkGeneratorInterface::generate() had been changed from a string to a URL type since then. I fixed that and also modified the first parameter based on the recommendation for translatable text given in LinkGeneratorInterface::generate()'s documentation.
I've incorporated the recommendations from #54 as follows:
- Changed the assertLink() test to use assertLinkByHref() instead
- Added a test to check that the link isn't present if the user lacks 'administer image styles' permission
I'm not sure if the code I added for the additional test is the cleanest way of doing it, so if you have feedback on that I'd appreciate it.
I wasn't sure how to cleanly implement the recommendation from #63 to move the link to the right side of the UI, so that is not done yet.
Comment #70
fietserwinThanks for updating the patch.
Implementing #63 does not seem so straightforward as there is inline text before the element, so just playing with display and/or float did not give me the desired results. To implement #63, we could add the link as the #description of the select element. this will place the link within the form element wrapper:
From there on, we need to make this description inline-block and give it some space before (I guess that putting a space in the :before will work for both LTR and RTL, whereas a margin-left will only work for LTR). so we need to add some css to it.
Rest of the patch is RTBC, thus if we don't consider #63 worth the hassle, the whole patch is RTBC for me.
Comment #71
hampercm commentedPutting the link into #description was a big help; thanks @fietserwin!
The link now appears to the side of the main UI flow, as per #63. I implemented RTL support based on how I've seen it done elsewhere in D8, using media queries.
Comment #72
fietserwinTo have the description wrap on very small screens, I arrived at this css. it also includes my idea for RTL support, feel free to pick your preferred method, but I think that overruling the nowrap should be added:
Note: \00a0 is the Unicode code for a nonbreakable space, as does not work in content, see e.g. http://stackoverflow.com/questions/16552397/css-how-to-add-white-space-before-elements-content.
Comment #73
hampercm commentedI added the CSS to override nowrap. I've left the implementation of RTL support as-is for consistency with other D8 CSS, though I do think your suggested way of doing it is pretty slick :)
Comment #74
fietserwinThanks, everything looks good now.
I was surprised by the possibilities of the #description tag you used (not a simple string, but a render array). It is not documented on the Form API page, but it works. However, the description div gets rendered but remains empty, only the content (the render array) is not rendered. And the aria-describedby attribute on the select element thus refers to an empty element or to the link.
Comment #75
alexpottWe should be injecting the url_generator here instead of using \Drupal::url()
Comment #76
rpayanmComment #77
fietserwinThanks for picking this up. I think that this addresses the concern of #75.
Comment #78
alexpottThis issue is a prioritized change (usability) as per https://www.drupal.org/core/beta-changes and it's benefits outweigh any disruption. Committed 3741a5e and pushed to 8.0.x. Thanks!