Skip to content

Instantly share code, notes, and snippets.

@msonnabaum
Created June 13, 2013 03:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save msonnabaum/6f723b1d84e1e99bed55 to your computer and use it in GitHub Desktop.
Save msonnabaum/6f723b1d84e1e99bed55 to your computer and use it in GitHub Desktop.
<?php
class ControllerBase {
function setTranslator($translator) {
$this->translator = $translator;
}
function getTranslator() {
if (!$this->translator) {
$this->translator = \Drupal::translate();
}
}
function translate($string) {
return $this->getTranslator($string);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment