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


PHP AdminHelper::arrayToObject方法代码示例

本文整理汇总了PHP中AdminHelper::arrayToObject方法的典型用法代码示例。如果您正苦于以下问题:PHP AdminHelper::arrayToObject方法的具体用法?PHP AdminHelper::arrayToObject怎么用?PHP AdminHelper::arrayToObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AdminHelper的用法示例。


在下文中一共展示了AdminHelper::arrayToObject方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getFormFields

 public function getFormFields($fieldType, $parseFromTo = false)
 {
     if ($parseFromTo && !$this->fromToParsed) {
         $formFields = array();
         foreach ($this->formFields as $field) {
             if ($field->fromTo && $field->search) {
                 $newField = AdminHelper::objectToArray($field);
                 $newField['hidden'] = array('add' => true, 'edit' => true, 'view' => true);
                 $fromField = $newField;
                 $fromField['property'] = $field->property . "_fieldFrom";
                 $fromField['label'] = $newField['label'] . " " . trans('gtcms.from');
                 if (isset($fromField['search']['label'])) {
                     $fromField['search']['label'] = $fromField['search']['label'] . " " . trans('gtcms.from');
                 }
                 $fromField['search']['fieldFrom'] = true;
                 $fromField['table'] = false;
                 $fromField['sideTable'] = false;
                 $fromField = AdminHelper::arrayToObject($fromField);
                 $toField = $newField;
                 $toField['property'] = $field->property . "_fieldTo";
                 $toField['label'] = $newField['label'] . " " . trans('gtcms.to');
                 if (isset($toField['search']['label'])) {
                     $toField['search']['label'] = $toField['search']['label'] . " " . trans('gtcms.to');
                 }
                 $toField['search']['fieldTo'] = true;
                 $toField['table'] = false;
                 $toField['sideTable'] = false;
                 $toField = AdminHelper::arrayToObject($toField);
                 $formFields[] = $fromField;
                 $formFields[] = $toField;
                 $field->search = false;
                 $formFields[] = $field;
             } else {
                 $formFields[] = $field;
             }
         }
         $this->fromToParsed = true;
         $this->formFields = $formFields;
     }
     if ($fieldType == 'all') {
         return $this->formFields;
     } else {
         if ($fieldType == 'regular') {
             $fields = array();
             foreach ($this->formFields as $field) {
                 if (!$field->langDependent) {
                     $fields[] = $field;
                 }
             }
             return $fields;
         } else {
             if ($fieldType == 'langDependent') {
                 $fields = array();
                 foreach ($this->formFields as $field) {
                     if (config('gtcms.premium') && $field->langDependent) {
                         $fields[] = $field;
                     }
                 }
                 return $fields;
             } else {
                 Dbar::error("ModelConfig - getFormFields: fieldType is incorrect! - " . $fieldType);
             }
         }
     }
     return false;
 }
开发者ID:gtcrais,项目名称:gtcms,代码行数:66,代码来源:ModelConfig.php


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