TYPO3 CMS  TYPO3_6-2
WorkspaceTitleViewHelper.php
Go to the documentation of this file.
1 <?php
3 
23 
28  protected $workspaceRepository = NULL;
29 
35  static protected $workspaceTitleRuntimeCache = array();
36 
43  public function render($uid) {
44  if (isset(static::$workspaceTitleRuntimeCache[$uid])) {
45  return htmlspecialchars(static::$workspaceTitleRuntimeCache[$uid]);
46  }
47 
48  if ($uid === 0) {
49  static::$workspaceTitleRuntimeCache[$uid] = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('live', $this->controllerContext->getRequest()->getControllerExtensionName());
50  } elseif (!\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('workspaces')) {
51  static::$workspaceTitleRuntimeCache[$uid] = '';
52  } else {
54  $workspace = $this->workspaceRepository->findByUid($uid);
55  // $workspace may be null, force empty string in this case
56  static::$workspaceTitleRuntimeCache[$uid] = ($workspace === NULL) ? '' : $workspace->getTitle();
57  }
58 
59  return htmlspecialchars(static::$workspaceTitleRuntimeCache[$uid]);
60  }
61 
62 }
$uid
Definition: server.php:36
static translate($key, $extensionName, $arguments=NULL)