Created
March 1, 2019 18:26
-
-
Save ydsood/d1e279621bde8e854a79ba603fd4658b to your computer and use it in GitHub Desktop.
Export custom select field. Refer to https://github.com/phacility/phabricator/pull/845/commits/77b126b73fa18fc367cfb96b27f0b7163ef6f92f
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
final class PhabricatorStandardCustomFieldSelect | |
extends PhabricatorStandardCustomField { | |
//***************// | |
//Existing Code here | |
//**************// | |
/* | |
* Adding new function | |
*/ | |
protected function newExportFieldType() { | |
return new PhabricatorSelectExportField($this); //Need to inject a reference to the instance of the object | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
final class PhabricatorSelectExportField | |
extends PhabricatorExportField { | |
private $phabricatorStandardCustomSelectField; | |
function __construct($_phabricatorStandardCustomSelectField){ | |
$this->phabricatorStandardCustomSelectField = $_phabricatorStandardCustomSelectField; | |
} | |
public function setPhabricatorStandardCustomSelectField($value){ | |
$this->phabricatorStandardCustomSelectField = $value; | |
return $this; | |
} | |
public function getPhabricatorStandardCustomSelectField(){ | |
return $this->phabricatorStandardCustomSelectField; | |
} | |
public function getTextValue($value) { | |
$field = $this->getPhabricatorStandardCustomSelectField(); | |
$field_Options = $field->getOptions(); | |
return $field_Options[$value]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment