本文整理汇总了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 '';
});
}
示例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);
}
示例3: registerFormSubmit
private function registerFormSubmit()
{
FormBuilder::macro('button_submit', function ($texte) {
return FormBuilder::submit($texte, ['class' => 'btn btn-info pull-right']);
});
}
示例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">×</span></button>
<h4 class="modal-title">' . $title . '</h4>
</div>
<div class="modal-body">