当前位置: 首页>>代码示例>>PHP>>正文


PHP PhabricatorApplicationSearchEngine::getSearchFieldsForConduit方法代码示例

本文整理汇总了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);
    }
开发者ID:pugong,项目名称:phabricator,代码行数:51,代码来源:PhabricatorSearchEngineAPIMethod.php


注:本文中的PhabricatorApplicationSearchEngine::getSearchFieldsForConduit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。