$get_key = $this->connection->query("SELECT * FROM tablekeys WHERE id IN ( SELECT MAX(id) FROM tablekeys WHERE key = 'System' GROUP BY ip) ORDER BY id DESC");
The problem i have is that i can not get any node data like $nid or the node object of the node the media file is beeing attached to.
It is a node with an entity reference(media) and i wanted to create a custom token using taxonmy terms of that node. But that is impossible if i can not get any node data to process.
We have a node with a single value field that uses Inline Entity Form Simple form widget. This works well for us and we do pre-populate that field in the xxxx-edit-form form_alter. So we just load the node we want to default to and assign it to the the ief widget like this: