跑道获取表格 API - 订单表格字段

Podio get form API - Order form fields

我正在使用 Podio-API 在我的 php 网络应用程序中获取网络表单的字段。

跑道 - 获取表格文档:https://developers.podio.com/doc/forms/get-form-53754

使用 PHP 跑道库,我正在获取跑道网络表单,如下所示:

$webForm = PodioForm::get($form_id);

$fields = $webForm->fields;

此处的表单字段未按 Web 表单中的设置排序。有什么方法可以对表单字段进行排序吗?

我花了 5 分钟才在文档中找到答案:) http://podio.github.io/podio-php/items/

排序项目

您可以按各种属性对项目进行排序。 See a full list in the API reference.

// Sort by last edit date for the items, descending
$collection = PodioItem::filter(123, array(
  'sort_by' => 'last_edit_on',
  'sort_desc' => true
));

跑道不会在网络表单中存储字段顺序。该顺序将始终匹配应用程序中字段的顺序。

所以,如果在应用程序中我们有字段:text1 text2 category1 category2
并且在 webform 中只启用了一些字段:text1 category2

然后代码:

$webForm = PodioForm::get($form_id);
$fields = $webForm->fields;

将 return 仅 text1category2 字段(以任何顺序)。


并且如果你想以与 webform 相同的顺序显示字段,那么你需要读取应用程序设置并从应用程序中获取字段列表,并注意字段配置中的 delta 设置。

delta 设置的说明在这里:https://developers.podio.com/doc/applications/get-app-22349

"delta": An integer indicating the order of the field compared to other fields