Project

General

Profile

Actions

Bug #45513

closed

pi_getLL does not allow clearing labels via Typoscript any more

Added by Stephan Großberndt about 11 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Localization
Target version:
-
Start date:
2013-02-15
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
4.7
PHP Version:
Tags:
Complexity:
easy
Is Regression:
Sprint Focus:

Description

Since TYPO3 4.7.4 (in 4.5 the issue does not exist) it is not possible anymore to clear a language label.

Example:

pi_list_browseresults_page is a label used in pibase->pi_list_browseresults to prepend e.g. "Page" to the links to pages, so you get "Page 1 - Page 2 - Page 3 - ..." as links. The fallback value in browseresults is "Page":

 $pageText = trim($this->pi_getLL('pi_list_browseresults_page','Page',$hscText).' '.($a+1));

Before 4.7.5 it was possible to add Typoscript in the template like this:

plugin.tx_myplugin_using_pagebrowse {
   _LOCAL_LANG.de {
      pi_list_browseresults_page =
    }
}

resulting in a cleared pi_list_browseresults_page that produces the links "1 - 2 - 3 - ...".

This is due to the !empty-check in pi_getLL - it does not allow an empty string and directly jumps to the else case.

public function pi_getLL($key, $alternativeLabel = '', $hsc = FALSE) {
    $word = NULL;
    if (!empty($this->LOCAL_LANG[$this->LLkey][$key][0]['target'])) {

Using a check like this resolves the problem:

public function pi_getLL($key, $alternativeLabel = '', $hsc = FALSE) {
    $word = NULL;
    if (!empty($this->LOCAL_LANG[$this->LLkey][$key][0])) {


No check for the actual value of the label but check, if there is a existing definition with source/target instead.


Related issues 1 (0 open1 closed)

Is duplicate of TYPO3 Core - Bug #43959: Overriding labels through TypoScript does not workClosedMichael Stucki2012-12-13

Actions
Actions #1

Updated by Markus Klein about 11 years ago

!empty($this->LOCAL_LANG[$this->LLkey][$key][0])

Using empty on an array is not the nicest piece of code one can imagine...
Actions #2

Updated by Patrick Broens about 11 years ago

  • Category set to Localization
  • Complexity set to easy
Actions #3

Updated by Stephan Großberndt about 11 years ago

Markus Klein wrote:

[...]
Using empty on an array is not the nicest piece of code one can imagine...

Why and what would you suggest?

Actions #4

Updated by Markus Klein about 11 years ago

Sorry, I thought that this was clear, my mistake.
I'd prefer to have a simple is_array() or even isset() check on [$key][0] instead of empty().
I'm not sure if [0] is always present. If so, then is_array() is sufficient, otherwise isset() is mandatory to avoid PHP warnings.

Actions #5

Updated by Stephan Großberndt about 11 years ago

  • Target version set to 4.7.11
Actions #6

Updated by Markus Klein about 11 years ago

  • Target version deleted (4.7.11)
Actions #7

Updated by Georg Ringer almost 11 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF