* The TYPO3 project - inspiring people to share!
*/
+use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
*/
public function setParent($parent)
{
- $this->parent = $parent;
+ $this->parent = $this->extractId($parent);
}
/**
*/
public function setSource($source)
{
- $this->source = $source;
+ $this->source = $this->extractId($source);
}
/**
return $scopes;
}
+ /**
+ * Extracts real id from provided id-value, which can either be a real
+ * integer value, a 'NEW...' id, or a combined identifier 'tt_content_13'.
+ *
+ * @param int|string $idValue
+ * @return int|string
+ */
+ protected function extractId($idValue)
+ {
+ if (MathUtility::canBeInterpretedAsInteger($idValue)) {
+ return $idValue;
+ } elseif (strpos($idValue, 'NEW') === 0) {
+ return $idValue;
+ } else {
+ // @todo Handle if $tableName does not match $this->tableName
+ list($tableName, $id) = BackendUtility::splitTable_Uid($idValue);
+ return $id;
+ }
+ }
+
/**
* @return null|State
*/