Differential D19854 Diff 47435 src/applications/transactions/query/PhabricatorEditEngineConfigurationSearchEngine.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/transactions/query/PhabricatorEditEngineConfigurationSearchEngine.php
| Show First 20 Lines • Show All 109 Lines • ▼ Show 20 Lines | protected function renderResultList( | ||||
| $list = id(new PHUIObjectItemListView()) | $list = id(new PHUIObjectItemListView()) | ||||
| ->setUser($viewer); | ->setUser($viewer); | ||||
| foreach ($configs as $config) { | foreach ($configs as $config) { | ||||
| $item = id(new PHUIObjectItemView()) | $item = id(new PHUIObjectItemView()) | ||||
| ->setHeader($config->getDisplayName()); | ->setHeader($config->getDisplayName()); | ||||
| $id = $config->getID(); | $id = $config->getID(); | ||||
| if ($id) { | |||||
| $item->addIcon('fa-file-text-o bluegrey', pht('Form %d', $id)); | |||||
| $key = $id; | |||||
| } else { | |||||
| $item->addIcon('fa-file-text bluegrey', pht('Builtin')); | |||||
| $key = $config->getBuiltinKey(); | |||||
| } | |||||
| $item->setHref("/transactions/editengine/{$engine_key}/view/{$key}/"); | |||||
| if ($config->getIsDefault()) { | if ($config->getIsDefault()) { | ||||
| $item->addAttribute(pht('Default Create Form')); | $item->addAttribute(pht('Default Create Form')); | ||||
| } | } | ||||
| if ($config->getIsEdit()) { | if ($config->getIsEdit()) { | ||||
| $item->addAttribute(pht('Edit Form')); | $item->addAttribute(pht('Edit Form')); | ||||
| } | } | ||||
| if ($config->getIsDisabled()) { | if ($config->getIsDisabled()) { | ||||
| $item->setDisabled(true); | $item->setDisabled(true); | ||||
| $item->setStatusIcon('fa-ban grey', pht('Disabled')); | $item->setStatusIcon('fa-ban grey', pht('Disabled')); | ||||
| } else { | } else { | ||||
| $item->setStatusIcon('fa-file-text-o green', pht('Enabled')); | $item->setStatusIcon('fa-file-text-o green', pht('Enabled')); | ||||
| } | } | ||||
| $subtype_key = $config->getSubtype(); | |||||
| if ($subtype_key !== PhabricatorEditEngineSubtype::SUBTYPE_DEFAULT) { | |||||
| $engine = $config->getEngine(); | |||||
| if ($engine->supportsSubtypes()) { | |||||
| $map = $engine->newSubtypeMap(); | |||||
| if ($map->isValidSubtype($subtype_key)) { | |||||
| $subtype = $map->getSubtype($subtype_key); | |||||
| $icon = $subtype->getIcon(); | |||||
| $color = $subtype->getColor(); | |||||
| $item->addIcon("{$icon} {$color}", $subtype->getName()); | |||||
| } | |||||
| } | |||||
| } | |||||
| if ($id) { | |||||
| $item->setObjectName(pht('Form %d', $id)); | |||||
| $key = $id; | |||||
| } else { | |||||
| $item->addIcon('fa-file-text bluegrey', pht('Builtin')); | |||||
| $key = $config->getBuiltinKey(); | |||||
| } | |||||
| $item->setHref("/transactions/editengine/{$engine_key}/view/{$key}/"); | |||||
| $list->addItem($item); | $list->addItem($item); | ||||
| } | } | ||||
| return id(new PhabricatorApplicationSearchResultView()) | return id(new PhabricatorApplicationSearchResultView()) | ||||
| ->setObjectList($list); | ->setObjectList($list); | ||||
| } | } | ||||
| } | } | ||||