mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-26 22:48:19 +01:00
3838e14ad8
Summary: Images and cover files can now be attached calling need functions for PholioMockQuery. Mock list will show cover files for mocks. MockView uses new feature to show the first image Test Plan: Verified that images are shown. Reviewers: epriestley CC: aran, Korvin Maniphest Tasks: T2364 Differential Revision: https://secure.phabricator.com/D4644
55 lines
1.2 KiB
PHP
55 lines
1.2 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @group pholio
|
|
*/
|
|
final class PholioImage extends PholioDAO
|
|
implements PhabricatorMarkupInterface {
|
|
|
|
const MARKUP_FIELD_DESCRIPTION = 'markup:description';
|
|
|
|
protected $mockID;
|
|
protected $filePHID;
|
|
protected $name = '';
|
|
protected $description = '';
|
|
protected $sequence;
|
|
|
|
private $file;
|
|
|
|
/* -( PhabricatorMarkupInterface )----------------------------------------- */
|
|
|
|
|
|
public function getMarkupFieldKey($field) {
|
|
$hash = PhabricatorHash::digest($this->getMarkupText($field));
|
|
return 'M:'.$hash;
|
|
}
|
|
|
|
public function newMarkupEngine($field) {
|
|
return PhabricatorMarkupEngine::newMarkupEngine(array());
|
|
}
|
|
|
|
public function getMarkupText($field) {
|
|
return $this->getDescription();
|
|
}
|
|
|
|
public function didMarkupText($field, $output, PhutilMarkupEngine $engine) {
|
|
return $output;
|
|
}
|
|
|
|
public function shouldUseMarkupCache($field) {
|
|
return (bool)$this->getID();
|
|
}
|
|
|
|
public function attachFile(PhabricatorFile $file) {
|
|
$this->file = $file;
|
|
return $this;
|
|
}
|
|
|
|
public function getFile() {
|
|
if ($this->file === null) {
|
|
throw new Exception("Call attachFile() before getFile()!");
|
|
}
|
|
return $this->file;
|
|
}
|
|
|
|
}
|