Skip to content

Instantly share code, notes, and snippets.

@lorenzo
Created December 2, 2013 10:23
Show Gist options
  • Save lorenzo/7747593 to your computer and use it in GitHub Desktop.
Save lorenzo/7747593 to your computer and use it in GitHub Desktop.
<?php
$formatter = function($entity) use ($preferredlanguage, $translatedFields) {
foreach ($entity->translations as $translation) {
if ($translation->locale === $preferredlanguage) {
foreach ($translatedFields as $f) {
$entity->set($f, $translation->get($f));
}
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment