Description of the need
Redirecting to a node or other entity page is unnecessarily cumbersome. Common approaches include:
// Manual assembly for known entity types:
backdrop_goto('node/' . $node->nid);
// Using URI for general entities:
$uri = $entity->uri();
backdrop_goto($uri['path'], $uri['options']);
// Trying to shorthand the above into a single line:
backdrop_goto($entity->uri()['path']);
Proposed solution
Create a short-hand wrapper function around backdrop_goto()
that makes redirecting to entities easier.
function entity_goto(Entity $entity) {
$uri = $entity->uri();
backdrop_goto($uri['path'], $uri['options']);
}
Alternatives that have been considered
Maybe also create $entity->goto()
method?
GitHub Issue #:
5838
Recent comments
Very interesting - seems useful. But it gives me an error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 't.langcode' in 'where clause': SELECT t.translation FROM {...
Ubercart in Danish?
You can always use Translation template extractor to extract the untranslated strings from a specific module (like Ubercart). Very easy to use.
Ubercart in Danish?
Thank you Olaf, I am in the process of getting every string on my experimental site with Ubercart translated by ChatGPT - so far with very acceptable result (better than I could do...
Ubercart in Danish?