Timeline for How to get the "field" value of config entity, with bundles, that is defined in a bundle while creating content
Current License: CC BY-SA 4.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 13, 2020 at 12:56 | comment | added | Hodba Khalaf | Many thanks man. It's working like a charm | |
Apr 13, 2020 at 11:32 | history | edited | 4uk4 | CC BY-SA 4.0 |
add check for WebSiteTypeInterface
|
Apr 13, 2020 at 9:44 | comment | added | 4uk4 |
$bundle_field_name in my code example is the field in the content entity referencing the bundle, not a field in the bundle itself.
|
|
Apr 13, 2020 at 9:42 | comment | added | Hodba Khalaf | Thanks again. the bundle field name "service_endpoint_url" | |
Apr 13, 2020 at 9:41 | history | edited | 4uk4 | CC BY-SA 4.0 |
add generic way
|
Apr 13, 2020 at 9:35 | comment | added | 4uk4 | I've suggested a shortcut, if you know the bundle field. I add a more generic way to the answer. | |
Apr 13, 2020 at 9:33 | comment | added | Hodba Khalaf | I tried the hook_ENTITY_TYPE_presave and still getting the same error. I am sure the entity has bundles. Is there anything else I can try? Thanks for the support 4k4 | |
Apr 13, 2020 at 9:18 | comment | added | 4uk4 | You have to check the entity type or use hook_ENTITY_TYPE_presave. Not all entity types have bundles. | |
Apr 13, 2020 at 9:13 | comment | added | Hodba Khalaf |
Thanks 4k4 for the fast response. I tried it but it didn't work Error: Call to a member function getServiceUrl() on null in aegir_websites_manager_entity_presave() here is the Hook: function MY_MODULE_entity_presave(EntityInterface $entity){ $url = $entity->bundle->entity->getServiceUrl(); } What do you think?
|
|
Apr 13, 2020 at 7:50 | history | answered | 4uk4 | CC BY-SA 4.0 |