[TYPO3-dev] Correct check for localisation and workspace in fe plugin

Christian Welzel gawain at camlann.de
Tue Jan 24 18:48:52 CET 2012


Hi there,

what is the correct way to determine the uid of a content element in a
fe-plugin regarding localisation and workspaces?

I found these variants:

1)

if (isset($this->cObj->parentRecord['data']['_ORIG_uid'])) {
    $uid = $this->cObj->parentRecord['data']['_ORIG_uid'];
}
else if (isset($this->cObj->parentRecord['data']['_LOCALIZED_UID'])) {
    $uid = $this->cObj->parentRecord['data']['_LOCALIZED_UID'];
} else {
    $uid = $this->cObj->parentRecord['data']['uid'];
}

2)

if (isset($this->cObj->parentRecord['data']['_LOCALIZED_UID'])) {
    $uid = $this->cObj->parentRecord['data']['_LOCALIZED_UID'];
} else {
    if (isset($this->cObj->parentRecord['data']['_ORIG_uid'])) {
       $uid = $this->cObj->parentRecord['data']['_ORIG_uid'];
    } else {
       $uid = $this->cObj->parentRecord['data']['uid'];
    }
}

3)

$uid = $this->cObj->parentRecord['data']['uid'];
if(isset($this->cObj->parentRecord['data']['_LOCALIZED_UID'])) {
    $uid = $this->cObj->parentRecord['data']['_LOCALIZED_UID'];
}
if(isset($this->cObj->parentRecord['data']['_ORIG_uid'])) {
    $uid = $this->cObj->parentRecord['data']['_ORIG_uid'];
}

4)

$uid = $this->cObj->parentRecord['data']['uid'];
if(isset($this->cObj->parentRecord['data']['_ORIG_uid'])) {
    $uid = $this->cObj->parentRecord['data']['_ORIG_uid'];
}
if(isset($this->cObj->parentRecord['data']['_LOCALIZED_UID'])) {
    $uid = $this->cObj->parentRecord['data']['_LOCALIZED_UID'];
}


-- 
  MfG, Christian Welzel

   GPG-Key:     http://www.camlann.de/de/pgpkey.html
   Fingerprint: 4F50 19BF 3346 36A6 CFA9 DBDC C268 6D24 70A1 AD15



More information about the TYPO3-dev mailing list