1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-29 02:02:41 +01:00
phorge-phorge/src/applications/transactions/query/PhabricatorEditEngineQuery.php
epriestley 9aee90f8c1 Allow form configurations to retitle and reorder forms and add preambles
Summary:
Ref T9132. This just makes edited forms do //something//, albeit not anything very useful yet.

You can now edit a form and:

  - Retitle it;
  - add a preamble (instructions on top of the form); and
  - reorder the form's fields.

Test Plan:
{F974632}

{F974633}

{F974634}

{F974635}

{F974636}

Reviewers: chad

Reviewed By: chad

Subscribers: hach-que

Maniphest Tasks: T9132

Differential Revision: https://secure.phabricator.com/D14503
2015-11-22 15:12:57 -08:00

53 lines
1.1 KiB
PHP

<?php
final class PhabricatorEditEngineQuery
extends PhabricatorCursorPagedPolicyAwareQuery {
private $engineKeys;
public function withEngineKeys(array $keys) {
$this->engineKeys = $keys;
return $this;
}
protected function loadPage() {
$engines = PhabricatorEditEngine::getAllEditEngines();
if ($this->engineKeys !== null) {
$engines = array_select_keys($engines, $this->engineKeys);
}
return $engines;
}
protected function willFilterPage(array $engines) {
$viewer = $this->getViewer();
foreach ($engines as $key => $engine) {
$app_class = $engine->getEngineApplicationClass();
if ($app_class === null) {
continue;
}
$can_see = PhabricatorApplication::isClassInstalledForViewer(
$app_class,
$viewer);
if (!$can_see) {
$this->didRejectResult($engine);
unset($engines[$key]);
continue;
}
}
return $engines;
}
public function getQueryApplicationClass() {
return 'PhabricatorTransactionsApplication';
}
protected function getResultCursor($object) {
return null;
}
}