本文整理匯總了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">