Differential D21844 Diff 52063 src/applications/slowvote/controller/PhabricatorSlowvoteEditController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/slowvote/controller/PhabricatorSlowvoteEditController.php
Show First 20 Lines • Show All 193 Lines • ▼ Show 20 Lines | $poll_type_options = array( | ||||
pht('Plurality (Single Choice)'), | pht('Plurality (Single Choice)'), | ||||
PhabricatorSlowvotePoll::METHOD_APPROVAL => | PhabricatorSlowvotePoll::METHOD_APPROVAL => | ||||
pht('Approval (Multiple Choice)'), | pht('Approval (Multiple Choice)'), | ||||
); | ); | ||||
$response_type_map = SlowvotePollResponseVisibility::getAll(); | $response_type_map = SlowvotePollResponseVisibility::getAll(); | ||||
$response_type_options = mpull($response_type_map, 'getNameForEdit'); | $response_type_options = mpull($response_type_map, 'getNameForEdit'); | ||||
$visibility = $poll->getResponseVisibility(); | |||||
if (!isset($response_type_options[$visibility])) { | |||||
$visibility_object = | |||||
SlowvotePollResponseVisibility::newResponseVisibilityObject( | |||||
$visibility); | |||||
$response_type_options = array( | |||||
$visibility => $visibility_object->getNameForEdit(), | |||||
) + $response_type_options; | |||||
} | |||||
if ($is_new) { | if ($is_new) { | ||||
$form->appendChild( | $form->appendChild( | ||||
id(new AphrontFormSelectControl()) | id(new AphrontFormSelectControl()) | ||||
->setLabel(pht('Vote Type')) | ->setLabel(pht('Vote Type')) | ||||
->setName('method') | ->setName('method') | ||||
->setValue($poll->getMethod()) | ->setValue($poll->getMethod()) | ||||
->setOptions($poll_type_options)); | ->setOptions($poll_type_options)); | ||||
} else { | } else { | ||||
▲ Show 20 Lines • Show All 74 Lines • Show Last 20 Lines |