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


PHP MY_Model::form_fields方法代码示例

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


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

示例1: array

 /**
  * Add FUEL specific changes to the form_fields method
  *
  * @access	public
  * @param	string
  * @param	int
  * @return	boolean
  */
 function form_fields($values = array(), $related = array())
 {
     $fields = parent::form_fields($values, $related);
     $order = 1;
     // create default images
     $upload_path = assets_server_path('', 'images');
     $order = 1;
     foreach ($fields as $key => $field) {
         $fields[$key]['order'] = $order;
         // get field names that end with _image
         if ($fields[$key]['type'] == 'string' and substr($key, -5) == 'image' or substr($key, -3) == 'img') {
             $img = '';
             if (!empty($values['id'])) {
                 if (!empty($values[$key])) {
                     $img = '<div class="img_display"><img src="' . img_path($values[$key]) . '" style="float: right;"/></div>';
                 }
             }
             $fields[$key]['class'] = 'asset_select';
             $order++;
             $fields[$key . '_upload'] = array('order' => $order, 'before_html' => $img, 'label' => '... OR upload an image', 'upload_path' => $upload_path, 'type' => 'file', 'overwrite' => TRUE);
         }
         $order++;
     }
     $yes = lang('form_enum_option_yes');
     $no = lang('form_enum_option_no');
     if (isset($fields['published'])) {
         $fields['published']['order'] = 9999;
         $fields['published']['options'] = array('yes' => $yes, 'no' => $no);
     }
     if (isset($fields['active'])) {
         $fields['active']['order'] = 9999;
         $fields['active']['options'] = array('yes' => $yes, 'no' => $no);
     }
     return $fields;
 }
开发者ID:rwestergren,项目名称:FUEL-CMS,代码行数:43,代码来源:base_module_model.php

示例2: form_fields

 /**
  * Add FUEL specific changes to the form_fields method
  *
  * @access	public
  * @param	array Values of the form fields (optional)
  * @param	array An array of related fields. This has been deprecated in favor of using has_many and belongs to relationships (deprecated)
  * @return	array An array to be used with the Form_builder class
  */
 public function form_fields($values = array(), $related = array())
 {
     $fields = parent::form_fields($values, $related);
     $order = 1;
     // create default images
     $upload_path = assets_server_path('', 'images');
     $order = 1;
     foreach ($fields as $key => $field) {
         $fields[$key]['order'] = $order;
         $order++;
     }
     $yes = lang('form_enum_option_yes');
     $no = lang('form_enum_option_no');
     if (isset($fields['published'])) {
         $fields['published']['order'] = 9999;
         $fields['published']['options'] = array('yes' => $yes, 'no' => $no);
     }
     if (isset($fields['active'])) {
         $fields['active']['order'] = 9999;
         $fields['active']['options'] = array('yes' => $yes, 'no' => $no);
     }
     return $fields;
 }
开发者ID:prgoncalves,项目名称:Beatcrumb-web,代码行数:31,代码来源:base_module_model.php

示例3: form_fields

 /**
  * Add FUEL specific changes to the form_fields method
  *
  * @access	public
  * @param	array Values of the form fields (optional)
  * @param	array An array of related fields. This has been deprecated in favor of using has_many and belongs to relationships (deprecated)
  * @return	array An array to be used with the Form_builder class
  */
 public function form_fields($values = array(), $related = array())
 {
     $fields = parent::form_fields($values, $related);
     // $order = 1;
     // foreach($fields as $key => $field)
     // {
     // 	$fields[$key]['order'] = $order;
     // 	$order++;
     // }
     $yes = lang('form_enum_option_yes');
     $no = lang('form_enum_option_no');
     if (isset($fields['published'])) {
         $fields['published']['order'] = 9999;
         $fields['published']['options'] = array('yes' => $yes, 'no' => $no);
     }
     if (isset($fields['active'])) {
         $fields['active']['order'] = 9999;
         $fields['active']['options'] = array('yes' => $yes, 'no' => $no);
     }
     if (!empty($this->form_fields_class) and class_exists($this->form_fields_class)) {
         $fields = new $this->form_fields_class($fields, $values, $this);
     }
     return $fields;
 }
开发者ID:scotton34,项目名称:sample,代码行数:32,代码来源:base_module_model.php


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