setResource($page); } static public function getDescription(): string { return "The twitter image used in twitter card"; } static public function getLabel(): string { return "Twitter Image"; } public static function getName(): string { return self::PROPERTY_NAME; } static public function getPersistenceType(): string { return Metadata::PERSISTENT_METADATA; } static public function isMutable(): bool { return true; } public function setFromStoreValueWithoutException($value): Metadata { if ($value === null) { $pageImages = PageImages::createForPage($this->getResource()) ->setReadStore($this->getReadStore()) ->getValueAsPageImages(); foreach ($pageImages as $pageImage) { if (in_array(PageImageUsage::TWITTER, $pageImage->getUsages())) { return parent::setFromStoreValueWithoutException($pageImage->getImagePath()->toAbsoluteId()); } } } return parent::setFromStoreValueWithoutException($value); } public function getDefaultValue() { return SocialCardImage::createFromResourcePage($this->getResource()) ->getValueOrDefault(); } static public function getDrive(): string { return WikiPath::MEDIA_DRIVE; } static public function isOnForm(): bool { return true; } public static function getCanonical(): string { return "twitter"; } }