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


PHP Framework::getFieldSizes方法代码示例

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


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

示例1: __callStatic

 /**
  * Creates a field instance
  *
  * @param  string $method     The field type
  * @param  array  $parameters An array of parameters
  * @return Former
  */
 public static function __callStatic($method, $parameters)
 {
     // Form opener
     if (str_contains($method, 'open')) {
         static::$form = new Form();
         return static::form()->open($method, $parameters);
     }
     // Avoid conflict with chained label method
     if ($method == 'label') {
         return call_user_func_array('static::_label', $parameters);
     }
     // Checking for any supplementary classes
     $classes = explode('_', $method);
     $method = array_pop($classes);
     // Destroy previous field instance
     static::$field = null;
     // Picking the right class
     if (class_exists('\\Former\\Fields\\' . ucfirst($method))) {
         $callClass = ucfirst($method);
     } else {
         switch ($method) {
             case 'multiselect':
                 $callClass = 'Select';
                 break;
             case 'checkboxes':
                 $callClass = 'Checkbox';
                 break;
             case 'radios':
                 $callClass = 'Radio';
                 break;
             case 'files':
                 $callClass = 'File';
                 break;
             default:
                 $callClass = 'Input';
                 break;
         }
     }
     // Listing parameters
     $class = '\\Former\\Fields\\' . $callClass;
     static::$field = new $class($method, array_get($parameters, 0), array_get($parameters, 1), array_get($parameters, 2), array_get($parameters, 3), array_get($parameters, 4), array_get($parameters, 5));
     // Inline checkboxes
     if (in_array($callClass, array('Checkbox', 'Radio')) and in_array('inline', $classes)) {
         static::$field->inline();
     }
     // Add any size we found
     $size = Framework::getFieldSizes($classes);
     if ($size) {
         static::$field->addClass($size);
     }
     return new Former();
 }
开发者ID:raftalks,项目名称:former,代码行数:59,代码来源:Former.php

示例2: __callStatic

 /**
  * Creates a field instance
  *
  * @param  string $method     The field type
  * @param  array  $parameters An array of parameters
  * @return Former
  */
 public static function __callStatic($method, $parameters)
 {
     // Form opener
     if (str_contains($method, 'open')) {
         static::$form = new Form();
         static::form()->open($method, $parameters);
         return new static();
     }
     // Avoid conflict with chained label method
     if ($method == 'label') {
         return call_user_func_array('static::_label', $parameters);
     }
     // Checking for any supplementary classes
     $classes = explode('_', $method);
     $method = array_pop($classes);
     // Destroy previous field instance
     static::$field = null;
     // Picking the right class
     if (class_exists(static::FIELDSPACE . ucfirst($method))) {
         $callClass = ucfirst($method);
     } else {
         switch ($method) {
             case 'submit':
             case 'reset':
                 $callClass = 'Button';
                 break;
             case 'multiselect':
                 $callClass = 'Select';
                 break;
             case 'checkboxes':
                 $callClass = 'Checkbox';
                 break;
             case 'radios':
                 $callClass = 'Radio';
                 break;
             case 'files':
                 $callClass = 'File';
                 break;
             default:
                 $callClass = 'Input';
                 break;
         }
     }
     // Check for potential errors
     if (!class_exists(static::FIELDSPACE . $callClass)) {
         throw new \Exception('The class "' . static::FIELDSPACE . $callClass . '" called by field "' . $method . '" doesn\'t exist');
     }
     // Listing parameters
     $class = static::FIELDSPACE . $callClass;
     static::$field = new $class($method, array_get($parameters, 0), array_get($parameters, 1), array_get($parameters, 2), array_get($parameters, 3), array_get($parameters, 4), array_get($parameters, 5));
     // Inline checkboxes
     if (in_array($callClass, array('Checkbox', 'Radio')) and in_array('inline', $classes)) {
         static::$field->inline();
     }
     // Filter classes according to field type
     $classes = $callClass == 'Button' ? Framework::getButtonTypes($classes) : Framework::getFieldSizes($classes);
     // Add any supplementary classes we found
     if ($classes) {
         static::$field->addClass($classes);
     }
     // As Buttons are more of a helper class, we return them directly
     if ($callClass == 'Button') {
         return static::$field;
     }
     return new static();
 }
开发者ID:iyoworks,项目名称:former,代码行数:73,代码来源:Former.php


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