code/dataobjects/CdnImage.php
public function getCMSFields() {
		$fields = parent::getCMSFields();

		$previewField = new LiteralField("SecureImageFull",
				"<img id='thumbnailImage' class='thumbnail-preview' src='".$this->Link()."' alt='Secured File' />\n"
		);

		$url = $this->Link();// 5 minute link expire
		$link = ReadonlyField::create('CDNUrl', 'CDN reference',  $this->CDNFile);

		$link->dontEscape = true;

		if ($top = $fields->fieldByName('Root.Main.FilePreview')) {
			$field = $top->fieldByName('FilePreviewImage');
			$field->insertBefore($previewField, 'ImageFull');
			$field->removeByName('ImageFull');
			$top->replaceField('CDNUrl', $link);
		}

		return $fields;
	}
public function getCMSFields() {
		$fields = parent::getCMSFields();

		$previewField = new LiteralField("SecureImageFull",
				"<img id='thumbnailImage' class='thumbnail-preview' src='".$this->Link()."' alt='Secured File' />\n"
		);

		$url = $this->Link();// 5 minute link expire
		$link = ReadonlyField::create('CDNUrl', 'CDN reference',  $this->CDNFile);

		$link->dontEscape = true;

		if ($top = $fields->fieldByName('Root.Main.FilePreview')) {
			$field = $top->fieldByName('FilePreviewImage');
			$field->insertBefore($previewField, 'ImageFull');
			$field->removeByName('ImageFull');
			$top->replaceField('CDNUrl', $link);
		}

		return $fields;
	}
public function getCMSFields ( ) { $ fields = parent :: getCMSFields ( ) ; $ previewField = new LiteralField ( "SecureImageFull" , "<img id='thumbnailImage' class='thumbnail-preview' src='" . $ this -> Link ( ) . "' alt='Secured File' />\n" ) ; $ url = $ this -> Link ( ) ; // 5 minute link expire $ link = ReadonlyField :: create ( 'CDNUrl' , 'CDN reference' , $ this -> CDNFile ) ; $ link -> dontEscape = true ; if ( $ top = $ fields -> fieldByName ( 'Root.Main.FilePreview' ) ) { $ field = $ top -> fieldByName ( 'FilePreviewImage' ) ; $ field -> insertBefore ( $ previewField , 'ImageFull' ) ; $ field -> removeByName ( 'ImageFull' ) ; $ top -> replaceField ( 'CDNUrl' , $ link ) ; } return $ fields ; }
Replaces the Preview Image and Link with secured links if the file is secured.
@return FieldList
Replaces the Preview Image and Link with secured links if the file is secured .