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


PHP Helpers::addClass方法代码示例

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


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

示例1: open

 /**
  * Opens up magically a form
  *
  * @param  string $typeAsked  The form type asked
  * @param  array  $parameters Parameters passed
  * @return string             A form opening tag
  */
 public function open($typeAsked, $parameters)
 {
     $method = 'POST';
     $secure = false;
     $action = array_get($parameters, 0);
     $attributes = array_get($parameters, 1);
     // If classic form
     if ($typeAsked == 'open') {
         $type = Former::$defaultFormType;
     } else {
         // Look for HTTPS form
         if (str_contains($typeAsked, 'secure')) {
             $typeAsked = str_replace('secure', null, $typeAsked);
             $secure = true;
         }
         // Look for file form
         if (str_contains($typeAsked, 'for_files')) {
             $typeAsked = str_replace('for_files', null, $typeAsked);
             $attributes['enctype'] = 'multipart/form-data';
         }
         // Calculate form type
         $type = trim(str_replace('open', null, $typeAsked), '_');
         if (!in_array($type, $this->availableTypes)) {
             $type = Former::$defaultFormType;
         }
     }
     // Add the final form type
     $attributes = Helpers::addClass($attributes, 'form-' . $type);
     // Store it
     $this->type = $type;
     // Open the form
     return \Form::open($action, $method, $attributes, $secure);
 }
开发者ID:nigobo,项目名称:laravel-play,代码行数:40,代码来源:Form.php

示例2: open

 /**
  * Opens up magically a form
  *
  * @param  string $typeAsked  The form type asked
  * @param  array  $parameters Parameters passed
  * @return string             A form opening tag
  */
 public function open($typeAsked, $parameters)
 {
     $action = array_get($parameters, 0);
     $method = array_get($parameters, 1, 'POST');
     $attributes = array_get($parameters, 2, array());
     $secure = array_get($parameters, 3, false);
     // If classic form
     if ($typeAsked == 'open') {
         $type = Config::get('default_form_type');
     } else {
         // Look for HTTPS form
         if (str_contains($typeAsked, 'secure')) {
             $typeAsked = str_replace('secure', null, $typeAsked);
             $secure = true;
         }
         // Look for file form
         if (str_contains($typeAsked, 'for_files')) {
             $typeAsked = str_replace('for_files', null, $typeAsked);
             $attributes['enctype'] = 'multipart/form-data';
         }
         // Calculate form type
         $type = trim(str_replace('open', null, $typeAsked), '_');
         if (!in_array($type, $this->availableTypes)) {
             $type = Config::get('default_form_type');
         }
     }
     // Add the final form type
     $attributes = Helpers::addClass($attributes, 'form-' . $type);
     // Store it
     $this->type = $type;
     // Fetch errors if asked for
     if (Config::get('fetch_errors')) {
         Former::withErrors();
     }
     // Open the form
     $this->action = $action;
     $this->method = $method;
     $this->attributes = $attributes;
     $this->secure = $secure;
     return $this;
 }
开发者ID:iyoworks,项目名称:former,代码行数:48,代码来源:Form.php

示例3: show

 /**
  * Return html.
  *
  * @return string
  */
 public function show()
 {
     return self::view('indicator', ['tag' => $this->tag, 'attributes' => Helpers::addClass($this->attributes, $this->class . ' ' . $this->type), 'message' => $this->message]);
 }
开发者ID:aperdia,项目名称:aperdiaui,代码行数:9,代码来源:Indicator.php

示例4: addClass

 /**
  * Add a class to the current field
  *
  * @param string $class The class to add
  */
 public function addClass($class)
 {
     $this->attributes = Helpers::addClass($this->attributes, $class);
 }
开发者ID:nigobo,项目名称:laravel-play,代码行数:9,代码来源:Field.php


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