I wanted to set the title to the place name. The attached patch could be made dynamic like the other fields. But, this was a good improvement for my project.
| Comment | File | Size | Author |
|---|---|---|---|
| gp-autoset-title.patch | 466 bytes | greg boggs |
I wanted to set the title to the place name. The attached patch could be made dynamic like the other fields. But, this was a good improvement for my project.
| Comment | File | Size | Author |
|---|---|---|---|
| gp-autoset-title.patch | 466 bytes | greg boggs |
Comments
Comment #2
hargobindAt the moment, the module has this line which works for Nodes:
$entity->title = (trimed/cleaned-up version of $place['name']);I understand that your patch is meant to work for Entities which tend to use
$entity->label.Do you think it would cause any problems to just add
$entity->labelafter$entity->title, or should I do a more extensive check for the correct label property as demonstrated in entity_label() (i.e. ['label callback'] or ['entity keys']['label'])?Comment #3
tyler.frankenstein commentedlabelwon't work across entity types, i.e. for nodes it istitle, for taxonomy terms itsname, for comments it'ssubject, etcA dynamic approach to finding the correct label machine name is the right method.
Comment #4
greg boggsThat's not surprising. Mostly, I just needed the patch for entity, so that my GP entities had titles. But, a better solution would be ideal.
Comment #5
tyler.frankenstein commentedGreg, I'm curious, are you using ECK to create custom entity types, or rolling your own via a custom module? I ask because AFAIR the ECK module uses the title field to store entity titles. If you're using a custom module, I'm guessing you're able to specify the machine name of the label...?
Comment #7
hargobindI just committed a fix to the dev branch that should detect an entity's "label" property. It seems to work correctly for nodes, taxonomy terms, and custom entities. Would y'all be available to test it?
Comment #8
greg boggsAlmost all of ThinkShout's modules rely on entities. MailChimp, Registration, Redhen, Salesforce... In this case, I was using this module to set the address on a RedHen organization. So, when a user selects their location, I create an organization for them with the correct address from GP.
Comment #10
hargobindI made a checkbox on the field instance settings form for "Set title/label" to be optional. I think it's ready for prime-time.