entity = $entity; $this->path = $path; $this->version = $version; $this->stable = $stable; // check what languages that this instance will support. $langs = scandir($path); $available = array(); if($langs) { $possible = i18n::get_common_languages(true); $possible['en'] = true; foreach($langs as $key => $lang) { if(isset($possible[$lang])) { $this->supportedLanguages[$lang] = Injector::inst()->create( 'DocumentationEntityLanguage', $this, $lang ); } else { } } } } /** * @return string */ public function Link() { if($this->stable) { return $this->entity->Link(); } return Controller::join_links($this->entity->Link(), $this->version); } /** * Return the languages which are available for this version of the entity. * * @return array */ public function getSupportedLanguages() { return $this->supportedLanguages; } /** * Return whether this entity has a given language. * * @return bool */ public function hasLanguageSupport($lang) { return (in_array($lang, $this->getSupportedLanguages())); } /** * @return float */ public function getVersion() { return $this->version; } /** * @return string */ public function getPath() { return $this->path; } /** * @return string */ public function getBaseFolder() { return $this->entity->getFolder(); } /** * @return string */ public function getTitle() { return $this->entity->getTitle(); } }