Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
field system
Priority:
Major
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
6 Jun 2013 at 18:34 UTC
Updated:
29 Jul 2014 at 22:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
swentel commentedJust a quick test on deleting hook_field_delete_field as there's only one implementation.
Also note to self, need to look for hook_field_read_field and hook_field_read_instance implementations.
Comment #2
swentel commentedComment #3
swentel commentedThis should have them all - except for
readComment #5
swentel commentedFixes the image tests.
Comment #6
amateescu commentedThis doesn't look right :)
Comment #8
swentel commented@amateescu - haha. Note, in case someone starts screaming for a test, do that in a follow up!
In the meantime, fix the rest of the tests.
Comment #9
swentel commentedAnd last hooks: goodbye hook_field_read_field() and hook_field_read_instance()
Comment #10
swentel commentedThat was so totally wrong
Comment #11
yched commentedThanks for this !
For performance, I guess it's recommended to rather implement hook_[ENTITY_TYPE]_[OP]() ?
The "generic" hook_entity_[OP]() are there for the cases where you want to react for all config entities, or all fieldable entities...
(also applies to the other hook migrations in the patch ?)
Something looks weird here. $entity->type is checked twice with BC/array and object syntax ?
Since this code is de facto new code, I'd say it should not continue using the BC array syntax. $entity['foo'] definitely looks weird :-)
(same for the new image_entity_[op]() implementations)
double $$
(and switch to ->id() ?)
That's a property that only exists at a specific point in the object lifecycle (during save() if updating an existing field entity), but is documented as always being present. We should move field_has_data() to a method on the Field entity IMO.
Not great either, for the same reasons. Less sure about how we can make that better, though.
This looks like a more general issue with hook_entity_update().
I opened #2017809: how do hook_entity_update() implementations access the "previous" state of the entity ? for this.
No better suggestion for now, let's leave it that way here, I guess...
(same for FieldInstance::$originalInstance - maybe at least name both properties just "$original" ?)
Nitpick: I think core tends to avoid starting function bodies with an empty line.
Comment #12
swentel commentedBeen looking for that, but this doesn't seem to be supported, unless I'm really stupid ...
Will look at the other ones this evening.
Comment #13
yched commentedhook_[ENTITY_TYPE]_[OP]() :
see ConfigStorageController::invokeHook()
Comment #14
swentel commentedOh, crap shoot me, I just saw
and was like, damn, that's sad. Note to self: click the actual method, djeezes.
Comment #15
yched commentedNope, /me won't shoot @swentel
Comment #16
swentel commentedThis is pretty badass now. Not sure if the interdiff is useful as it's pretty big :)
- Changed all hooks - talked to timplunkett how the docblock should be for it.
- removed BC where possible
- The 'original' properties are the same
- I left hasData as is for now as it's also used in hook_update_forbid and I didn't want to start touching those hooks as well. I'm fine with a follow up if you're ok with that
- One line nitpicks :)
Let's see if I didn't forget anything.
Comment #18
swentel commented#16: 2013939-16.patch queued for re-testing.
Comment #19
yched commentedOK, let's go with a followup for hasData.
IMO we could write:
which would make code in the func body much easier to understand.
Maybe even :
but I'm less sure about that.
Comment #20
swentel commentedGood point, I'll see how it behaves with FieldInterface or FieldInstanceInterface
Comment #21
swentel commentedAlright, filed #2018731: Move field_has_data() to Field::hasData()
Comment #22
swentel commentedSeems to work fine
Comment #23
yched commentedLooks good :-)
RTBC if green.
Comment #25
yched commented"Argument 1 passed to field_test_field_instance_delete() must be an instance of FieldInstanceInterface, instance of Drupal\field\Plugin\Core\Entity\FieldInstance given"
This looks like a missing "use" statement for FieldInstanceInterface in field_test.something :-)
Comment #26
swentel commentedYes indeed :) Found two minor docblock mistakes too while fixing it.
Comment #27
yched commented... if green
Comment #28
yched commentedRelated : #2020895: Move save() / delete() logic in Field / FieldInstance to [pre|post]Save(), [pre|post]Delete()...
(this one is still RTBC, though)
Comment #29
amateescu commentedRerolled.
Comment #31
amateescu commentedNeeded some more updates for #1818568: Convert files to the new Entity Field API.
Comment #32
alexpottNeeds a reroll
Comment #33
swentel commentedThere's more todo than a reroll because of #2018731: Move field_has_data() to Field::hasData()
Comment #34
pcambraActually
entity_reference_field_update_fieldis the conflicting function and there's no "has data" check there, so here's a re-roll #31Comment #35
swentel commentedThis should go now, people need to use the static method if they want to use it.
Comment #36
pcambraRemoving has data reference mentioned in #35
Comment #37
swentel commentedSweet!
Comment #39
swentel commented#36: 2013939-36.patch queued for re-testing.
Comment #40
swentel commentedComment #41
effulgentsia commented#36: 2013939-36.patch queued for re-testing.
Comment #43
effulgentsia commented#36: 2013939-36.patch queued for re-testing.
Comment #44
effulgentsia commentedBack to RTBC. Sorry for the noise. Just wanted to make sure it still passed after other Field API commits in the last 12 hours.
Comment #45
alexpottCommitted 5ff3e98 and pushed to 8.x. Thanks!
Comment #46
yched commentedChange notification added at https://drupal.org/node/2054619
Comment #47
yched commentedMore accurate title for posterity
Comment #48.0
(not verified) commentedUpdated issue summary.