【问题标题】:Podio PHP: category is empty when no value for itemPodio PHP:当项目没有值时,类别为空
【发布时间】:2017-02-07 04:51:49
【问题描述】:

我们正在使用 Podio PHP 库为我们的用户创建表单。这些表单通过 Podio PHP 库从 Podio 加载数据。为此,表单已链接到特定的 Podio 项目 ID。

使用此 ID,我们可以获取字段及其可能的值。其中大部分是类别字段。我们得到这个低谷的值:

<?php

   $item_data = PodioItem::get_basic( $podio_item_id );

   $car_types = $item_data->fields["car-type"]->config['settings']['options'];

   var_dump( $car_types );

?>

但奇怪的是,如果 Podio 中的项目没有为该类别选择任何值,则获取选项会失败。它是空的。它不存在。

即使项目没有为它选择选项,我们如何用值填充表单?

【问题讨论】:

    标签: php podio


    【解决方案1】:

    Podio 不存储空值,它是空的,它不存在,所以没有什么可存储的。实际上,您可能正在寻找的是 Application 定义,它具有列表字段。然后类别字段具有可能值列表以及 id 和颜色的配置。 像这样:

    "fields": [
          {
          "status": "active",
          "type": "category",
          "field_id": 81772,
          "label": "Status",
          "config": {
            "required": true,
            "label": "Status",
            .....some other config values .....
            "settings": {
              "multiple": false,
              "options": [
                {
                  "status": "deleted",         <= example of deleted category option
                  "text": "Not groomed",
                  "id": 13,
                  "color": "DCEBD8"
                },
                {
                  "status": "active",          <= example of active category option
                  "text": "Open",
                  "id": 1,
                  "color": "FFD5C2"
                },
                ....                           <= other category options goes here
    

    您可以在此处阅读有关应用程序的更多信息:https://developers.podio.com/doc/applications/get-app-22349

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-10
      • 1970-01-01
      • 2023-03-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多