Closed (fixed)
Project:
Focal Point
Version:
8.x-1.x-dev
Component:
Other Code
Priority:
Major
Category:
Feature request
Assigned:
Reporter:
Created:
7 Apr 2016 at 11:51 UTC
Updated:
11 May 2017 at 11:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
kikoalonsob commentedAttached patch solves it
Comment #3
mkolar commentedI can confirm this. #2 works for me (I can see image focal point widget now under form display).
Comment #4
bleen commentedThe idea was to not create a separate widget but rather to add all the logic needed directly to the existing image widget. I'm open to a discussion, but I don't really see a reason to have a completely separate widget.
Comment #5
slasher13I don't see the disadvantages (see https://www.drupal.org/node/1882526#why-annotations)
Comment #6
bleen commentedThere is no technical disadvantage, but I feel like that would be very confusing to a site builder. Right now, when it's time to choose a field widget for an image field they just choose "image" as they always have. With this patch they will see two choices (a) the standard image widget and (b) the focal point image widget both of which do exactly the same thing.
If I was a random site builder and saw this I would file a bug saying that I chose the image widget and not the focal point image widget but I'm still seeing the focal point functionality.
At the end of the day I'll turn this around and say, what are the advantages?
Comment #7
bleen commentedComment #8
tessa bakkerAdvantage of dedicated widget:
1) You (builder) can decide per field to use Focal Point, some other image widget or not
2) Content editor doesn't need to be bothered with Focal Point widgets on every image
Things todo:
1) Remove image widget alter
2) Notify builders that default image widget no longer has 'focal point', hook_update_N() ?
Alternative:
* Image Widget setting to enable/disable Focal Point as *third_party_settings*
* (nice 2 have) Default focal point X,Y per image widget as *third_party_settings*
Comment #9
tessa bakkerAfter some thinking, I liked the idea of some extra widget settings the most.
The patch will create widget settings to: disable/enable Focal Point, hide/show preview link, and set the default location of the focal point.
If needed I can create a update hook to enable Focal Point by default for existing image widgets.
As you can see, I didn't enabled Focal Point by default.
Comment #10
frank.schalkwijk commentedI tested #9 and it works. I really like the new settings added in #9, but I agree with kikoalonsob and slasher13 that focal point should use it's own form widget. The current implementation uses the Drupal 7 way to alter a widget while we are developing for Drupal 8.
If we'd make a custom widget, site administrators could easily choose whether they want to use focal point on a per instance basis. An other plus point is that the code for the widget can be located in one class, the widget class, instead of some code in the module and some in the class.
Comment #11
tessa bakkerI totally agree with frank.schalkwijk! It was very hard and ugly to create the current patch.
I'm happy to create a new patch if the maintainer is willing to commit to a "new" Image Widget for Focal Point.
Comment #12
bleen commentedWhat would happen to existing sites in this case?
Comment #13
frank.schalkwijk commentedA hook_update_N should update all existing image field instances to use the new widget.
I wouldn't use the focal point widget as default widget for new image fields, but that would also be possible.
Comment #14
tessa bakkerPatch in progress
Comment #15
tessa bakkerNew patch, without an update hook for now. An update hook can be created after approval of the patch.
There are some todos left, but that is more for after applying this patch.
Comment #16
spadxiii commentedWhy are the
validateFocalPointandprocessmethods static?can be written like:
and the same for
to:
or am I missing something from just reading the patch file? :)
Comment #17
bleen commentedTo be honest, I'm still not 100% sold on this, but I am warming to the idea (mostly because it seems that more and more people are asking for it). I still like the idea that installing focal point will work for existing image fields without any changes at all. I like that the is no setup needed. This adds something for the site builder to do to get focal point working (albeit something pretty trivial).
I'm putting some feelers out to some other folks to see if I can get even more opinions, but like I said I am warming to this.
That said:
this should be kept in mind when writing an update hook. If these values have been changed, they should be used by the field specific configs
this ++
I'm not sure about this. By keeping them separate, a focal point value can be validated programmatically.
Comment #18
tim.plunkettIndented weird. Also use [] not array().
Also I believe you need config schema for these settings. If this doesn't fail tests, there's not enough coverage.
@todo should have issue links
Out of scope
can use
static::classinstead of get_called_class()Comment #19
bleen commentedNote that I fixed the translatable string issues in #2848530: Make field label and link translatable on image widget
Comment #20
bleen commented... I spoke to a few more people today and I think that the benefits of this outweigh my desire to keep the setup as simple as humanly possible. Its not so unreasonable to expect a site builder to choose a different widget in order to have different functionality. Soooo... if we can whip this patch into shape and have a solid upgrade path then I'm on board.
Shout out to for giving me feedback
elijahlynn
jfrederick
tim.plunkett
Comment #21
tessa bakkerThanks for the feedback! Will implement the feedback a.s.a.p. but if anyone can fix it sooner, feel free to assign the issue to yourself. :)
Comment #22
tancWill this only affect image fields using the 'image' widget? What about users with the file/entity browser widget? Will this patch have any impact on the work done on #2701725: Integrate focal point with file entity and entity browser?
Comment #23
tancComment #24
tessa bakkerHi tanc,
I think this will affect every issue. But if it's done right, everything will work in the end.
Plan to get this work could be something like this:
Comment #25
tancSounds good :-)
I'll keep an eye on this and #2657592: Convert focal point selector tool into a standalone form element and help out where I can.
Comment #26
tessa bakkerIn progress..
Comment #27
tessa bakkerNew patch with the processed feedback and a few small fixes.
The interdiff is not 100% based on patch #15, this is because the translation issue has been fixed in dev.
Comment #28
bleen commentedNot sure why you are adding info about a progress indicator. What progress are we indicating? The image upload itself? Isn't that inherited from the standard image field widget?
Other than that, this is getting pretty close except for the update hook...
Comment #29
bleen commentedAnyone able to take a swing on the update hook?
Comment #30
berdyshev commentedI'm working on hook_update, will submit a patch in a while.
Comment #31
berdyshev commentedComment #32
webflo commentedI think we should have another condition which checks if the widget was image_image (image default widget).
Comment #33
berdyshev commentedYou are right.
Comment #34
webflo commentedThe patch from @berdyshev in #33 works great. Thanks!
Comment #35
webflo commentedThe updated failed on my site with "Failed: The "image_focal_point" plugin does not exist.". I think we should flush the widget definitions before update.
Comment #36
bleen commentedThis is REALLY REALLY close. I'm going to make it my unofficial goal to try and get this committed before the end of Drupalcon. If any of you are here... lets meet and finish this. :)
Yes! Good catch
But we need to figure out how to communicate (or force?) that people should pick an image style that maintains the aspect ratio of the original image AND does not include a focal point effect. Can we (at least) add to the field description right now and add an @todo for enforcing this at a later date.
I'm concerned that this is confusing in the context of a field widget setting... It makes sense as a global default value that only a dev can really set but it seems very confusing to me for a site admin who is setting up focal point for the first time to be presented with this option.
The term offset is not meaningful to end users.
I'm going to try and find some people that are unfamiliar with focal point and do some informal, unscientific user testing
Thoughts?
This really should be
$summary[] = $this->t('Default focal point: @offsets', array('@offsets' => $offsets));The term offset is not meaningful to end users.
Comment #37
bleen commentedOk ... so I think this might be the one. The only differences are around clarifying some of the language... but otherwise I think this is good to go.
Comment #38
berdyshev commentedLooks good
Comment #40
bleen commentedI'll take that as RTBC ... COMMITTED!
Comment #41
webflo commentedAwesome, thanks! :)