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


PHP FormBuilder::macro方法代码示例

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


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

示例1: register

 /**
  * Register any application services.
  *
  * This service provider is a great spot to register your various container
  * bindings with the application. As you can see, we are registering our
  * "Registrar" implementation here. You can add your own bindings too!
  *
  * @return void
  */
 public function register()
 {
     parent::register();
     FormBuilder::macro('template', function ($template, $empty = false, $field = 'template') {
         $template_list = '';
         if ($empty) {
             $template_list[''] = '-';
         }
         $folder = base_path() . '/resources/views/site/';
         if (is_dir($folder)) {
             $iterator = new \DirectoryIterator($folder);
             foreach ($iterator as $fileinfo) {
                 if ($fileinfo->isFile() && !$fileinfo->isDot()) {
                     $file = explode('.', $fileinfo->getFilename());
                     array_pop($file);
                     $value = implode('.', $file);
                     $template_list[$value] = $value;
                 }
             }
         }
         if ($template_list) {
             return Form::select($field, $template_list, $template, ['class' => "form-control"]);
         }
         return '';
     });
 }
开发者ID:Ognestraz,项目名称:lumen-admin,代码行数:35,代码来源:MacroServiceProvider.php

示例2: macro

 /**
  * Register a custom macro.
  *
  * @param string $name
  * @param callable $macro
  * @return void 
  * @static 
  */
 public static function macro($name, $macro)
 {
     \Collective\Html\FormBuilder::macro($name, $macro);
 }
开发者ID:alvarobfdev,项目名称:BaseCRUDproject,代码行数:12,代码来源:_ide_helper.php

示例3: registerFormSubmit

 private function registerFormSubmit()
 {
     FormBuilder::macro('button_submit', function ($texte) {
         return FormBuilder::submit($texte, ['class' => 'btn btn-info pull-right']);
     });
 }
开发者ID:WizzerOmega,项目名称:webstock,代码行数:6,代码来源:HtmlFormServiceProvider.php

示例4: function

    $addon .= "</span>";
    $element = Form::password($name, field_attributes($name, $attributes));
    $out = '<div class="input-group">';
    $out .= $end ? '' : $addon;
    $out .= $element;
    $out .= $end ? $addon : '';
    $out .= '</div>';
    return field_wrapper($name, $label, $out);
});
Form::macro('passwordFieldIconClean', function ($name, $label = NULL, $content = 'lock', $end = false, array $attributes = [], $value = NULL) {
    $addon = '<span class="input-group-addon">';
    $addon .= '<span class="fa fa-' . $content . '"></span>';
    $addon .= "</span>";
    $attributes = array_merge($attributes, ['placeholder' => $label]);
    $element = Form::password($name, field_attributes($name, $attributes));
    $out = '<div class="input-group">';
    $out .= $end ? '' : $addon;
    $out .= $element;
    $out .= $end ? $addon : '';
    $out .= '</div>';
    return field_wrapper($name, $out, '');
});
HTML::macro('modal', function ($id, $title, $msg, $confirm = 'Sim', $close = 'Fechar') {
    $out = '<div class="modal fade" id="' . $id . '">
        <div class="modal-dialog modal-sm">
        <div class="modal-content">
        <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title">' . $title . '</h4>
        </div>
        <div class="modal-body">
开发者ID:brunoti,项目名称:html-macros,代码行数:31,代码来源:macros.php


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