Depends on #1969728: Implement Field API "field types" as TypedData Plugins
All core field types have to be converted to typed data plugins.
Ongoing work happens in core-modules-field-types-datatypes-2014671 based on field-types-as-datatypes-1969728 from the sandbox (http://drupalcode.org/sandbox/yched/1736366.git)
#2015703: Convert field type to typed data plugin for email module - commit
#2015701: Convert field type to typed data plugin for entity reference module
#2015697: Convert field type to typed data plugin for file and image modules
#2017139: Convert field type to typed data plugin for datetime module (has patch - but dates don't save for now)
#2015695: Convert field type to typed data plugin for image module
#2015693: Convert field type to typed data plugin for link module - commit
#2015691: Convert field type to typed data plugin for number module - commit
#2015689: Convert field type to typed data plugin for options module
#2015687: Convert field type to FieldType plugin for taxonomy module
#2015683: Convert field type to typed data plugin for telephone module - commit
#2083803: Convert field type to typed data plugin for field_test module
#2087381: Decouple EmailItem field class from LegacyFieldItem
#2087393: Remove LegacyField once all field types converted.
How to convert
- Move the existing FieldItem class for the field type into the right folder for plugin discovery.
- Make it extend ConfigFieldItemBase instead of LegacyConfigFieldItem.
- Move the hook_field_info() entries in annotations.
- Move the various "hook_field_*()" implementations to methods as per the mapping in the issue summary in #1969728: Implement Field API "field types" as TypedData Plugins.
For a simple example see the conversion of the telephone module: http://drupalcode.org/sandbox/yched/1736366.git/commitdiff/d2fb7014a9f5b... (needs update though for ConfigFieldItemBase)
Comments
Comment #1
swentel CreditAttribution: swentel commentedTagging, let's hope we can crowdsource this a little
Comment #2
swentel CreditAttribution: swentel commentedChanging to meta, I'll add the links to separate issues in a minute, we can use this one to list instructions etc.
Comment #2.0
swentel CreditAttribution: swentel commentedUpdated issue summary.
Comment #3
swentel CreditAttribution: swentel commentedNote, started a new branch based on field-types-as-datatypes-1969728 - I'll slowly start implementing a few 'easy' modules and one hard one to start battle testing the API so we get a bit up to speed. I'll merge from the field types branch all the time.
Comment #4
yched CreditAttribution: yched commentedYay, great idea !
Off the top of my head (can't look at code right now), the tasks to convert a field type are:
- move the existing FieldItem class for the field type into the right folder for plugin discovery
- make it extend CFieldItemBase instead of LegacyCFieldItem
- move the hook_field_info() entries in annotations
- move the various "hook_field_*()" implementations to methods as per the mapping in the issue summary in #1969728: Implement Field API "field types" as TypedData Plugins
And agreed, ideally, after the correct steps have been validated on a simple field type, the rest would be better off crowdsourced.
Note: this should start with a field type that doesn't implement hook_field_prepare_view(), since this one is not ported yet.
Comment #5
swentel CreditAttribution: swentel commentedI'll update this evening- edit updated issue summaryDid a little test with the telephone module, works nice locally
see http://drupalcode.org/sandbox/yched/1736366.git/commitdiff/d2fb7014a9f5b...
Comment #5.0
swentel CreditAttribution: swentel commentedUpdated issue summary.
Comment #5.1
swentel CreditAttribution: swentel commentedUpdated issue summary.
Comment #5.2
swentel CreditAttribution: swentel commentedUpdated issue summary.
Comment #5.3
swentel CreditAttribution: swentel commentedUpdated issue summary.
Comment #5.4
swentel CreditAttribution: swentel commentedUpdated issue summary
Comment #6
swentel CreditAttribution: swentel commentedSo email, link, number and telephone are done (although I'm not sure if number is totally ok - see commit links in the summary). Those were the easy ones :)
Going to take on taxonomy and entity reference tomorrow, I suspect the latter one to become interesting :)
Comment #7
yched CreditAttribution: yched commentedw00t !
Nothing strikes me on a quick read of the commitdiff - do you have specific concerns in mind ?
entity_reference & taxo might be better off waiting for #1965208: Convert TaxonomyTermReferenceItem to extend EntityReferenceItem.
There's also #1996714: Convert FileItem and ImageItem to extend EntityReferenceItem for image / file fields.
In the end, we'll probably want something like:
TaxoItem extends EntityRefItem
ImageItem extends FileItem extends EntityRefItem
but things should be easier after those two patches land.
Comment #8
swentel CreditAttribution: swentel commentedI just forgot to rerun the number field item test which had a fail, but the field api number field is green. So no biggie :)
Good to know re: entity reference, I'll target another one :)
Comment #8.0
swentel CreditAttribution: swentel commentedUpdated issue summary.
Comment #8.1
swentel CreditAttribution: swentel commentedUpdated issue summary.
Comment #9
swentel CreditAttribution: swentel commentedWe can start on this, oh dear.
Comment #9.0
swentel CreditAttribution: swentel commentedUpdated issue summary.
Comment #9.1
swentel CreditAttribution: swentel commentedUpdated issue summary.
Comment #9.2
pfrenssenFully spelled out LegacyConfigFieldItem. Formatted list.
Comment #10
fagoI think we can re-name this one though, as they are exposed as data type plugins by becoming field type plugins :-)
Comment #11
andypostHere's a bug introduced #2031707: field_sync_field_status() does not enable fields defined without hook_field_info()
Comment #12
BerdirI guess this one is critical, so that we can afterwards clean this up and remove the legacy layer and entity BC decorator usage.
Comment #13
yched CreditAttribution: yched commented@Berdir: I'm not sure the "field type" BC layer requires the entity BC decorator to keep working.
Comment #14
BerdirPossibly not, what I meant is that the current Field "dispatch" code has BC support into both directions, beside legacy field types, it also supports (doesn't require) BC entities, something that's no longer necessary because all fieldable entity types were converted. And I thought it would be easier to clean that up together but maybe not :)
Comment #14.0
BerdirTypo.
Comment #15
BerdirAdded #2083803: Convert field type to typed data plugin for field_test module to the list, looks like that was forgotten?
Comment #15.0
BerdirUpdated issue summary.
Comment #16
catchThere's just #2015689: Convert field type to typed data plugin for options module #2015687: Convert field type to FieldType plugin for taxonomy module and #2087393: Remove LegacyField once all field types converted. left. Marking this as duplicate and bumping the first to critical.
Comment #16.0
catchUpdated issue summary.