This could just be a documentation issue but here's my issue:

I have some fields that have sub parameters. Examples are Date and Currency fields. Right now there isn't a good way to call this. Calling the getCustomField() method (for field field_custom_field) is clunky and it's also possible that it doesn't return all the property callbacks. So for Currency for example calling the "amount_decimal" property is not possible without going down to the EntityFieldWrapper.

Is there any plans or method of doing this?

Comments

Derimagia created an issue. See original summary.

zengenuity’s picture

The need for a date field template is in #2364489: Include date format options for date type fields. For currency, is that a commerce_price type field? If so, we can add templates for that type too which will handle the subproperties in a reasonable way. Take a look at entityreference and image field templates for examples of how to add additional method templates for specific types of fields if you want to take a stab at it.

Derimagia’s picture

Assigned: Unassigned » Derimagia

The templates are nice for syntactic sugar, but I'm not sure that's the right approach since we want something that works on all fields. All of the info is in the EntityMetadataWrapper so it should be able to be got at. I'll take a look at the generator to see what can be done.

After we have this structure down, we can then add the templates on top of that but devs will have a backup option so they don't need to fallback to EnittyMetadataWrapper to get what they want.

zengenuity’s picture

Hmm...maybe an optional subproperty parameter on WdEntityWrapper::get().