I have created a content type called providers and when editting said content types users can fill in extra information related to the content.
I have included said form fields using hook_form_alter, and the appropriate hook for _submit applied with it all working fine (saving to db etc)
Where I am stuck is I can access the data, by loading it via hook_ENTITY_TYPE_load call which allows me to access it in _form_alter but for some reason when viewing the node, I do not see the data.
Is there a specific way of loading external data on top of node object in d8?
below is how i load the data.
/**
* Implements hook_ENTITY_TYPE_load($entities)
*/
function remittance_providers_node_load(array &$entities) {
//loop thorough the loaded entities
foreach ($entities as $key => $entity) {
// if provider node type is being loaded add our data on top of it.
if ($entity->bundle() == 'providers') {
$nid = $entity->id();
$commission_data = currencyStorage::loadCommission(array("companyID"=>$nid));
if(count($commission_data)>0){
foreach ($commission_data as $ckey => $comm) {
$entities[$key]->commission[$ckey]['amount_from'] = $comm->amount_from;
$entities[$key]->commission[$ckey]['amount_to'] = $comm->amount_to;
$entities[$key]->commission[$ckey]['commission'] = $comm->commission;
}
}
}
}
}
I have installed devel and checked all its phases and I dont see it in there.