public function setAllowedTypes($allowedTypes)
{
if (is_string($allowedTypes)) {
$allowedTypes = explode(",", $allowedTypes);
}
if (is_array($allowedTypes)) {
for ($i = 0; $i < count($allowedTypes); $i++) {
try {
Object\Fieldcollection\Definition::getByKey($allowedTypes[$i]);
} catch (\Exception $e) {
Logger::warn("Removed unknown allowed type [ {$allowedTypes[$i]} ] from allowed types of field collection");
unset($allowedTypes[$i]);
}
}
}
$this->allowedTypes = (array) $allowedTypes;
$this->allowedTypes = array_values($this->allowedTypes);
// get rid of indexed array (.join() doesnt work in JS)
return $this;
}