getPath()->toString(); $urlType = self::$urlTypeInstanceCache[$path]; if ($urlType === null) { $urlType = self::createFromPage($page); self::$urlTypeInstanceCache[$path] = $urlType; } return $urlType; } public static function createFromPage(ResourceCombo $page): PageUrlType { return (new PageUrlType()) ->setResource($page); } public function getValue(): ?string { $resourceCombo = $this->getResource(); if (!$resourceCombo->exists()) { return PageUrlType::CONF_VALUE_PAGE_PATH; } if (!($resourceCombo instanceof Page)) { LogUtility::msg("The page type is only for page"); return PageUrlType::CONF_VALUE_PAGE_PATH; } $confCanonicalType = $this->getName(); $confDefaultValue = $this->getDefaultValue(); $urlType = PluginUtility::getConfValue($confCanonicalType, $confDefaultValue); if (!in_array($urlType, self::CONF_VALUES)) { LogUtility::msg("The canonical configuration ($confCanonicalType) value ($urlType) is unknown and was set to the default one", LogUtility::LVL_MSG_ERROR, PageUrlPath::PROPERTY_NAME); return $confDefaultValue; } return $urlType; } public function getTab(): string { return MetaManagerForm::TAB_PAGE_VALUE; } public function getDescription(): string { return "The type of Url for pages"; } public function getLabel(): string { return "Page Url"; } static public function getName(): string { return PageUrlType::CONF_CANONICAL_URL_TYPE; } public function getPersistenceType(): string { return Metadata::PERSISTENT_METADATA; } public function getMutable(): bool { return true; } public function getDefaultValue(): string { return PageUrlType::CONF_CANONICAL_URL_TYPE_DEFAULT; } }