本文整理匯總了PHP中PhabricatorApplicationSearchEngine::getSearchFieldsForConduit方法的典型用法代碼示例。如果您正苦於以下問題:PHP PhabricatorApplicationSearchEngine::getSearchFieldsForConduit方法的具體用法?PHP PhabricatorApplicationSearchEngine::getSearchFieldsForConduit怎麽用?PHP PhabricatorApplicationSearchEngine::getSearchFieldsForConduit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PhabricatorApplicationSearchEngine
的用法示例。
在下文中一共展示了PhabricatorApplicationSearchEngine::getSearchFieldsForConduit方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: buildConstraintsBox
private function buildConstraintsBox(PhabricatorApplicationSearchEngine $engine)
{
$info = pht(<<<EOTEXT
You can apply custom constraints by passing a dictionary in `constraints`.
This will let you search for specific sets of results (for example, you may
want show only results with a certain state, status, or owner).
If you specify both a `queryKey` and `constraints`, the builtin or saved query
will be applied first as a starting point, then any additional values in
`constraints` will be applied, overwriting the defaults from the original query.
Specify constraints like this:
```lang=json, name="Example Custom Constraints"
{
...
"constraints": {
"authors": ["PHID-USER-1111", "PHID-USER-2222"],
"statuses": ["open", "closed"],
...
},
...
}
```
This API endpoint supports these constraints:
EOTEXT
);
$fields = $engine->getSearchFieldsForConduit();
// As a convenience, put these fields at the very top, even if the engine
// specifies and alternate display order for the web UI. These fields are
// very important in the API and nearly useless in the web UI.
$fields = array_select_keys($fields, array('ids', 'phids')) + $fields;
$rows = array();
foreach ($fields as $field) {
$key = $field->getConduitKey();
$label = $field->getLabel();
$type_object = $field->getConduitParameterType();
if ($type_object) {
$type = $type_object->getTypeName();
$description = $field->getDescription();
} else {
$type = null;
$description = phutil_tag('em', array(), pht('Not supported.'));
}
$rows[] = array($key, $label, $type, $description);
}
$table = id(new AphrontTableView($rows))->setHeaders(array(pht('Key'), pht('Label'), pht('Type'), pht('Description')))->setColumnClasses(array('prewrap', 'pri', 'prewrap', 'wide'));
return id(new PHUIObjectBoxView())->setHeaderText(pht('Custom Query Constraints'))->setCollapsed(true)->appendChild($this->buildRemarkup($info))->appendChild($table);
}