本文整理汇总了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;
}