Thank you for the useful module.
I'd like to handle this Machine name fields with Entity Metadata Wrapper. Is this request acceptable?
https://www.drupal.org/documentation/entity-metadata-wrappers
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | interdiff-2813785-9-13.txt | 589 bytes | hgoto |
| #13 | machine_name-integrate_with_entity_metadata_wrapper-2813785-13.patch | 3.64 KB | hgoto |
Comments
Comment #2
hgoto commentedHere is a patch for this feature.
How to test this patch:
field_my_machine.I'd like someone interested to review this patch. Thank you.
Comment #3
hgoto commentedComment #5
hgoto commentedComment #7
manu manuUsing the patch from #2 and haven't found any issues.
Thanks!
Comment #8
manu manuSpoken too quick. This work with nodes, not with other entities, eg: taxonomy terms.
This is because the
validation_callbackis using$parent->type->value()and not all entities have a type property.You should use
$parent->getBundle();Comment #9
hgoto commented@manu manu thank you for your review.
Surely,
$parent->type->value()doesn't support entities other than nodes and it's better to replace it with$parent->getBundle().I updated the patch and tested it in my local environment. I'd like someone to review this.
Comment #11
manu manuThanks @hgoto, testing right now.
Comment #12
hgoto commented@manu manu thank you!
Please wait a little. I didn't notice why the CI error causes until now. It's caused by the following line, I believe.
This line uses the returned array direct but this is not allowed in PHP with old versions.
http://php.net/manual/en/language.types.array.php
I'm going to fix it.
Comment #13
hgoto commentedI've updated the patch with change for the point #12.
I hope this would fix the CI error...
Comment #14
manu manuTested by getting and setting a machine_name field on a taxonomy term and it works well.
Thanks @hgoto.
Comment #15
danrodClosing this one, 7.x is deprecated for a while.
Comment #16
danrod