Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
link.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
9 Jun 2013 at 18:13 UTC
Updated:
29 Jul 2014 at 22:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
swentel commentedcommit at http://drupalcode.org/sandbox/yched/1736366.git/commitdiff/9931286d599e8...
Comment #2
swentel commentedComment #3
aspilicious commentedI see this in the sandbox commit, this ok?
Comment #4
swentel commentedNah, was wrong, have that ok locally already
Comment #5
mordonez commentedHi,
I updated the patch with the same format as Telephone field (namespace corrections and annotations).
Comment #6
mordonez commentedSorry I missed to add new and deleted files
Comment #7
mordonez commentedSorry I missed to add the new and deleted files
Comment #8
aspilicious commentedComment #9
yched commentedThanks @mordonez !
the instance should be accessed through $this->getInstance().
No need for the isset() check, it should always be set (I know this comes from the existing code, but let's clean this while we're here)
Let's avoid going through getValue().
This can be:
$this->url = trim($this->url);
$this->title = trim($this->title);
Comment #10
mordonez commentedThanks @yched.
here the corrections.
Comment #11
yched commentedthanks @mordonez!
hint: it's a good practice, when you post a new version of a patch, to also post an "interdiff" - a .txt file showing the diff between the previous and the new version. It helps reviews tremendously :-)
See https://drupal.org/documentation/git/interdiff (if you're on linux, the interdiff command line provided by the patchutils package is really handy).
Last nitpick - my bad, I should have spotted that earlier:
The goal is to make our FieldItem classes (like LinkItem here) be usable for configurable fields (that can be added through the UI) as well as base entity fields (that are hardcoded in the Entity definition).
This means relying as little as possible on the Field / FieldInstance definition structures that are specific to configurable fields, and instead use the FieldDefinitionInterface.
In this case, this will be as simple as replacing this line:
'#default_value' => $this->getInstance()->settings['title'],by
'#default_value' => $this->getFieldDefinition()->getFieldSetting('title'),:-)
Comment #12
mordonez commentedthanks for the interdiff's advice
here the patch that uses the FieldDefinitionInterface
Comment #13
mordonez commentedComment #14
yched commentedThanks !
Comment #15
yched commentedJust removed the 'module' entry now that #2041423: Rely on 'provider' instead of 'module' for Field plugin types is in.
Comment #16
alexpottCommitted a7dbbd5 and pushed to 8.x. Thanks!