public function setCurrentDataType(DataTypeDefinition $dataTypeDefinition) { $this->dataTypeDefinition = $dataTypeDefinition; $contentType = $dataTypeDefinition->getTitle(); if (!$contentType) { $contentType = $dataTypeDefinition->getName(); } // check workspaces $workspaces = $dataTypeDefinition->getWorkspaces(); if (!array_key_exists($this->getCurrentWorkspace(), $workspaces)) { reset($workspaces); list($key, $workspace) = each($workspaces); $this->setCurrentWorkspace($key); $this->addInfoMessage('Switching to workspace ' . $workspace . ' (' . $key . ') for content type ' . $contentType . '.'); } if ($dataTypeDefinition->hasLanguages()) { $languages = $dataTypeDefinition->getLanguages(); } else { $languages = array('default' => 'None'); } if (!array_key_exists($this->getCurrentLanguage(), $languages)) { reset($languages); list($key, $language) = each($languages); $this->setCurrentLanguage($key); $this->addInfoMessage('Switching to language ' . $language . ' (' . $key . ') for content type ' . $contentType . '.'); } if (!$dataTypeDefinition->isTimeShiftable() and $this->getCurrentTimeShift() != 0) { $this->resetTimeShift(); } }