The issue queue has lots of requests for custom handlers for custom entity properties:

#2090621: Ubercart Fields Integration
#2044197: Editable Taxonomy term title and description
#2036315: Commerce Product Entity support
#2017973: Add ability to edit path aliases

These are all going to look pretty similar. What I think we can do instead is create a generic handler, and use Entity API's metadata system to a) find properties that can be expose, and b) handle saving those properties.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hanoii’s picture

Issue summary: View changes

I am about to work on the ubercart fields integration as I kind of need it, not sure if I'll do it custom or trying to improve this module.

Either way I am not that familiar with the Entity API's metadata system, so if you are, I wonder if you can share your ideas on how this might work and I can see if I can try to work it out that way.

Thanks.

joachim’s picture

The entity metadata defines properties on entities. For all properties there is a 'getter callback'. Some also have a 'setter callback'. Each property also has a type defined.

I was thinking that all the properties that have a 'setter callback' and have a type that we can feasibly hope to create a sane form element for, AND which are not already FieldAPI fields, could share a common handler.

Anybody’s picture

This feature request becomes more and more important. A solution would be very very helpful for many modules and installation profiles.

joachim’s picture

Status: Active » Needs review
FileSize
23.9 KB

This came up in a client project, so I've implemented it.

Here's the patch (though our tests are failing at the moment due to dependencies not being declared to the testbot... they pass locally!)

  • Commit f912572 on 7.x-1.x by joachim:
    Issue #2090731 by joachim: Added an editable field handler for general...
joachim’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

kopeboy’s picture

could you release a new beta for this? I think is quite important :)

Thank you very much for the module!

joachim’s picture

I already did - beta 8. You can see it in the release notes: https://drupal.org/node/2244543.

You're welcome :)

Status: Closed (fixed) » Needs work

The last submitted patch, 4: 2090731.editableviews.metadata-property-handler.patch, failed testing.

joachim’s picture

Status: Needs work » Fixed

Testbot being weird...

ledom’s picture

May be a mention into readme or documentation on how to access ubercart fields ("enter entity or editable into searchbox") and others would be good.
Thanks a lot for your work, this was a big lack.

joachim’s picture

Good idea. Care to file a new issue for that and make a patch for the README? You can also add something to the documentation page: https://www.drupal.org/node/1943662

ledom’s picture

Thanks, will do that
Question, what about product stock level?
Unable to find this field into entity metadata. Is there a workaround?

joachim’s picture

You can either write a patch for Commerce stock so that the stock level has an Entity API metadata setter callback, or write an editable views handler for it. The first option is definitely preferable, as it adds something that's usable in a wider context.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

jkhanlar’s picture

I enabled versions 7.x-1.0-beta9 and 7.x-1.x-dev of this module to see if adding editable ubercart fields to a view was possible, and it seems that it is not. How can I add editable fields for ubercart fields/attributes in a view?

Status: Closed (fixed) » Needs review
joachim’s picture

Status: Needs review » Closed (fixed)

Please don't reopen old fixed issues. See comment #15 regarding further support for ubercart, and indeed any other entity type.

Status: Closed (fixed) » Needs work

The last submitted patch, 4: 2090731.editableviews.metadata-property-handler.patch, failed testing.

devad’s picture

Status: Needs work » Closed (fixed)

It took me a bit to find editable Taxonomy term name and description fields.

So, i'm just posting a tip here to help others.

Editable Taxonomy term name and description field are available as:

Taxonomy term: Entity metadata property (editable)

Add one such field with Metadata property: Name
And second one with Metadata property: Description

Thanx for great work!

Dr.Osd’s picture

I use latest dev version but have no way to access for commerce product title in editable views. How can I add to my view Commerce product Title (editable)??

joachim’s picture

Does it maybe not have a setter callback?

Dr.Osd’s picture

Maybe. I use module as is without additional settings. Do you have some documentation about setter callback?