/***************************************************************
* Copyright notice
*
- * (c) 2010 Steffen Ritter <info@steffen-ritter.net>
+ * (c) 2010-2011 Steffen Ritter <info@steffen-ritter.net>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
/**
* Gets the data provider, depending on TCA configuration
*
- * @static
* @param array $tcaConfiguration
* @return t3lib_tree_Tca_DatabaseTreeDataProvider
* @throws InvalidArgumentException
}
if ($tcaConfiguration['internal_type'] == 'db') {
- /**
- * @var $dataProvider t3lib_tree_Tca_DatabaseTreeDataProvider
- */
+ $unselectableUids = array();
+
+ /** @var $dataProvider t3lib_tree_Tca_DatabaseTreeDataProvider */
$dataProvider = t3lib_div::makeInstance('t3lib_tree_Tca_DatabaseTreeDataProvider');
if (isset($tcaConfiguration['foreign_table'])) {
$tableName = $tcaConfiguration['foreign_table'];
$dataProvider->setTableName($tableName);
+ if ($tableName == $table) {
+ $unselectableUids[] = $currentValue['uid'];
+ }
+
t3lib_div::loadTCA($tableName);
} else {
throw new InvalidArgumentException(
'TCA Tree configuration is invalid: "foreign_table" not set',
- '1288215888'
+ 1288215888
);
}
}
if (isset($treeConfiguration['appearance']['expandAll'])) {
- $dataProvider->setExpandAll((boolean)$treeConfiguration['appearance']['expandAll']);
+ $dataProvider->setExpandAll((boolean) $treeConfiguration['appearance']['expandAll']);
}
if (isset($treeConfiguration['appearance']['maxLevels'])) {
} else {
throw new InvalidArgumentException(
'TCA Tree configuration is invalid: neither "childrenField" nor "parentField" is set',
- '1288215889'
+ 1288215889
);
}
+
+ $dataProvider->setItemUnselectableList($unselectableUids);
} else {
throw new InvalidArgumentException(
'TCA Tree configuration is invalid: "treeConfig" array is missing',
- '1288215890'
+ 1288215890
);
}
} elseif ($tcaConfiguration['internal_type'] == 'file') {
- // Not implemented yet
+ // TODO Not implemented yet
throw new InvalidArgumentException(
'TCA Tree configuration is invalid: tree for "internal_type=file" not implemented yet',
- '1288215891'
+ 1288215891
);
} else {
throw new InvalidArgumentException(
'TCA Tree configuration is invalid: tree for "internal_type=' .
- $tcaConfiguration['internal_type'] .
- '" not implemented yet',
- '1288215892'
+ $tcaConfiguration['internal_type'] .
+ '" not implemented yet',
+ 1288215892
);
}
+
return $dataProvider;
}
}
-?>
+?>
\ No newline at end of file