當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。