在PodioAppField :: update上保留字段位置

时间:2017-11-01 12:00:45

标签: php podio

我正在关注文档https://developers.podio.com/doc/applications以及SDK中的给定模型。

我正在为现有的应用引用添加新应用,如下所示:

$attributes = array( 
        "referenced_apps" => array(ref_app_id1 , ref_app_id2)                        
    );

PodioAppField::update( 123 ,  'field_id' ,array (
                                                "settings" => $attributes
                                           ));

我现在的问题是,该字段以前位于第2位,而我在第1位有一个计算字段。 更新应用程序后,职位已经切换。

是否可以将字段保留在其原始位置而不将前面的字段添加到更新中? - 或者我是否必须重复前面的计算等?

TIA

1 个答案:

答案 0 :(得分:1)

是的,您可以使用属性delta保留当前位置以及设置。最好的方法是

$existing_field_config = PodioAppField::get( $app_id, $field_id )->config;

然后将新属性添加到现有配置变量中,以便其他字段配置保持不变。

$existing_field_config['settings']['referenced_apps'] = array(ref_app_id1 , ref_app_id2);
PodioAppField::update( 123 ,  'field_id' ,array (
                                            "settings" => $existing_field_config
                                       ));