Differential D14503 Diff 35174 src/applications/transactions/storage/PhabricatorEditEngineConfiguration.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/transactions/storage/PhabricatorEditEngineConfiguration.php
| Show First 20 Lines • Show All 93 Lines • ▼ Show 20 Lines | foreach ($fields as $key => $field) { | ||||
| if (array_key_exists($key, $values)) { | if (array_key_exists($key, $values)) { | ||||
| $field->readDefaultValueFromConfiguration($values[$key]); | $field->readDefaultValueFromConfiguration($values[$key]); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| $fields = $this->reorderFields($fields); | $fields = $this->reorderFields($fields); | ||||
| $head_instructions = $this->getProperty('instructions.head'); | $preamble = $this->getPreamble(); | ||||
| if (strlen($head_instructions)) { | if (strlen($preamble)) { | ||||
| $fields = array( | $fields = array( | ||||
| 'config.instructions.head' => id(new PhabricatorInstructionsEditField()) | 'config.preamble' => id(new PhabricatorInstructionsEditField()) | ||||
| ->setKey('config.instructions.head') | ->setKey('config.preamble') | ||||
| ->setValue($head_instructions), | ->setIsReorderable(false) | ||||
| ->setValue($preamble), | |||||
| ) + $fields; | ) + $fields; | ||||
| } | } | ||||
| return $fields; | return $fields; | ||||
| } | } | ||||
| private function reorderFields(array $fields) { | private function reorderFields(array $fields) { | ||||
| $keys = array(); | $keys = $this->getFieldOrder(); | ||||
| $fields = array_select_keys($fields, $keys) + $fields; | $fields = array_select_keys($fields, $keys) + $fields; | ||||
| // Now, move locked fields to the bottom. | // Now, move locked fields to the bottom. | ||||
| $head = array(); | $head = array(); | ||||
| $tail = array(); | $tail = array(); | ||||
| foreach ($fields as $key => $field) { | foreach ($fields as $key => $field) { | ||||
| if (!$field->getIsLocked()) { | if (!$field->getIsLocked()) { | ||||
| $head[$key] = $field; | $head[$key] = $field; | ||||
| Show All 29 Lines | public function getDisplayName() { | ||||
| $builtin = $this->getBuiltinKey(); | $builtin = $this->getBuiltinKey(); | ||||
| if ($builtin !== null) { | if ($builtin !== null) { | ||||
| return pht('Builtin Form "%s"', $builtin); | return pht('Builtin Form "%s"', $builtin); | ||||
| } | } | ||||
| return pht('Untitled Form'); | return pht('Untitled Form'); | ||||
| } | } | ||||
| public function getPreamble() { | |||||
| return $this->getProperty('preamble'); | |||||
| } | |||||
| public function setPreamble($preamble) { | |||||
| return $this->setProperty('preamble', $preamble); | |||||
| } | |||||
| public function setFieldOrder(array $field_order) { | |||||
| return $this->setProperty('order', $field_order); | |||||
| } | |||||
| public function getFieldOrder() { | |||||
| return $this->getProperty('order', array()); | |||||
| } | |||||
| /* -( PhabricatorPolicyInterface )----------------------------------------- */ | /* -( PhabricatorPolicyInterface )----------------------------------------- */ | ||||
| public function getCapabilities() { | public function getCapabilities() { | ||||
| return array( | return array( | ||||
| PhabricatorPolicyCapability::CAN_VIEW, | PhabricatorPolicyCapability::CAN_VIEW, | ||||
| PhabricatorPolicyCapability::CAN_EDIT, | PhabricatorPolicyCapability::CAN_EDIT, | ||||
| ▲ Show 20 Lines • Show All 43 Lines • Show Last 20 Lines | |||||