The only documentation on getValue() on https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21TypedData... is that it "Gets the data value."
While technically I guess its accurate, the implementation here adds logic that could do with an explanation. For example, it introduces logic to ignore Computed properties. Why? It would be helpful to put some of that here so people who stumble across have an idea of what's going on.
We ran into a problem recently with a custom field type and the interaction with Inline Entity Form.
It just seems that Computed properties are part of the "value" of a FieldItem, and some documentation would have helped us make a decision about which direction to go.
Comment | File | Size | Author |
---|---|---|---|
#14 | drupal-document_getValue-2869203-14.patch | 727 bytes | Liam Morland |
Comments
Comment #2
dawehner+1 always for better documention. This might also be a usecase where
FieldItemlistInterface
should override the method to provide a better documentation.Comment #14
Liam MorlandHere is some documentation that I would have found helpful. As mentioned in #2, it might be better to put this in
FieldItemListInterface
.Comment #15
Liam MorlandComment #17
Liam MorlandFailures are not related to the patch.
Comment #18
smustgrave CreditAttribution: smustgrave at Mobomo commentedYES! When I was starting in Drupal knowing this would of been nice.
I agree with both you that FieldItemListInterface seems like a good place though.