Skip to content

Commit

Permalink
Merge pull request FluidTYPO3#422 from NamelessCoder/evictlll
Browse files Browse the repository at this point in the history
[TASK] Evict LLL rewriting feature
  • Loading branch information
bjo3rnf committed Jan 3, 2014
2 parents 8bf2b5b + b2fcc71 commit a3c1f5d
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 854 deletions.
8 changes: 4 additions & 4 deletions Classes/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -339,15 +339,15 @@ public function setDescription($description) {
*/
public function getDescription() {
$description = $this->description;
$translated = NULL;
if (TRUE === empty($description)) {
$extensionKey = GeneralUtility::camelCaseToLowerCaseUnderscored($this->extensionName);
$description = 'LLL:EXT:' . $extensionKey . '/Resources/Private/Language/locallang.xlf:flux.' . $this->id . '.description';
}
if (0 === strpos($description, 'LLL:EXT:')) {
$translated = LocalizationUtility::translate($description, $extensionKey);
if (NULL !== $translated) {
return $translated;
}
}
return $description;
return $translated !== NULL ? $translated : $description;
}

/**
Expand Down
22 changes: 4 additions & 18 deletions Classes/Form/AbstractFormComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,7 @@ public function setLabel($label) {
*/
public function getPath() {
$prefix = '';
if (TRUE === $this instanceof Form) {
$prefix = '';
} elseif (TRUE === $this instanceof Sheet) {
if (TRUE === $this instanceof Sheet) {
$prefix = 'sheets';
} elseif (TRUE === $this instanceof Section) {
$prefix = 'sections';
Expand Down Expand Up @@ -326,21 +324,9 @@ public function getLabel() {
$relativeFilePath = $this->getLocalLanguageFileRelativePath();
$relativeFilePath = ltrim($relativeFilePath, '/');
$filePrefix = 'LLL:EXT:' . $extensionKey . '/' . $relativeFilePath;
$labelIdentifier = trim('flux.' . $id . '.' . $path, '.');
$this->writeLanguageLabel($filePrefix, $labelIdentifier, $id);
return $filePrefix . ':' . $labelIdentifier;
}

/**
* @param string $filePrefix
* @param string $labelIdentifier
* @param string $id
* @return void
*/
protected function writeLanguageLabel($filePrefix, $labelIdentifier, $id) {
if (TRUE === (boolean) $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['flux']['setup']['rewriteLanguageFiles']) {
$this->objectManager->get('FluidTYPO3\Flux\Service\LanguageFileService')->writeLanguageLabel($filePrefix, $labelIdentifier, $id);
}
$labelIdentifier = $filePrefix . ':' . trim('flux.' . $id . '.' . $path, '.');
$translated = LocalizationUtility::translate($labelIdentifier, $extensionKey);
return (NULL !== $translated ? $translated : $labelIdentifier);
}

/**
Expand Down
21 changes: 12 additions & 9 deletions Classes/Provider/AbstractProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -663,10 +663,7 @@ public function clearCacheCommand($command = array()) {
return;
}
$files = glob(PATH_site . 'typo3temp/flux-*');
if (FALSE === $files) {
return;
}
array_map('unlink', $files);
FALSE === $files ? : array_map('unlink', $files);
}

/**
Expand All @@ -689,7 +686,16 @@ public function getInheritanceTree(array $row) {
}

/**
* Get preview chunks - header and content - as array($header, $content)
* Get preview chunks - header and content - as
* array(string $headerContent, string $previewContent, boolean $continueRendering)
*
* Default implementation renders the Preview section from the template
* file that the actual Provider returns for $row, using paths also
* determined by $row. Example: fluidcontent's Provider returns files
* and paths based on selected "Fluid Content type" and inherits and
* uses this method to render a Preview from the template file in the
* specific path. This default implementation expects the TYPO3 core
* to render the default header, so it returns NULL as $headerContent.
*
* @param array $row The record data to be analysed for variables to use in a rendered preview
* @return array
Expand Down Expand Up @@ -720,10 +726,7 @@ public function getPreview(array $row) {
$previewContent = $view->renderStandaloneSection('Preview', $variables);
$this->configurationManager->setContentObject($existingContentObject);
$previewContent = trim($previewContent);
$headerContent = '';
if (FALSE === empty($label)) {
$headerContent = '<strong>' . $label . '</strong>';
}
$headerContent = NULL;
return array($headerContent, $previewContent, FALSE);
}

Expand Down
Loading

0 comments on commit a3c1f5d

Please sign in to comment.