本文整理汇总了PHP中Collective\Html\HtmlBuilder::macro方法的典型用法代码示例。如果您正苦于以下问题:PHP HtmlBuilder::macro方法的具体用法?PHP HtmlBuilder::macro怎么用?PHP HtmlBuilder::macro使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Collective\Html\HtmlBuilder
的用法示例。
在下文中一共展示了HtmlBuilder::macro方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: boot
public function boot()
{
$config = $this->app['config'];
$autoMinify = $config->get('assets.auto_minify');
if ($autoMinify !== true && $autoMinify !== false) {
$autoMinify = $config->get('app.debug', false);
}
Asset::$autoMinifyDefault = $autoMinify;
foreach ($config->get('assets.compilers', []) as $extensions => $class) {
$options = [];
if (is_array($class)) {
$options = array_get($class, 'options', []);
$class = $class['class'];
}
$compiler = new $class($autoMinify, $options);
foreach (explode(',', $extensions) as $extension) {
Asset::registerCompiler($extension, $compiler);
}
}
if ($this->app->resolved('router') || $this->app->bound('router')) {
$router = $this->app['router'];
$router->get('assets/img/{a?}/{b?}/{c?}/{d?}/{e?}', '\\Assets\\Http\\Controller@img');
$router->get('assets/font/{a?}/{b?}/{c?}/{d?}/{e?}', '\\Assets\\Http\\Controller@font');
$router->get('assets/fonts/{a?}/{b?}/{c?}/{d?}/{e?}', '\\Assets\\Http\\Controller@font');
$router->get('assets/css/{a?}/{b?}/{c?}/{d?}/{e?}', '\\Assets\\Http\\Controller@css');
$router->get('assets/{type}/{a?}/{b?}/{c?}/{d?}/{e?}', '\\Assets\\Http\\Controller@compile');
}
$this->commands(Console\PublishCommand::class, Console\UnpublishCommand::class, Console\InstallToolchainCommand::class);
if (class_exists('\\Collective\\Html\\HtmlBuilder')) {
\Collective\Html\HtmlBuilder::macro('assetPath', function ($path) {
return Asset::publishedPath($path);
});
}
$this->publishes([$this->configPath => config_path('assets.php')]);
}
示例2: registerHtmlButtonBack
private function registerHtmlButtonBack()
{
HtmlBuilder::macro('button_back', function () {
return '<a href="javascript:history.back()" class="btn btn-primary">
<span class="glyphicon glyphicon-back-arrow-left"></span> Retour
</a>';
});
}
示例3: macro
/**
* Register a custom macro.
*
* @param string $name
* @param callable $macro
* @return void
* @static
*/
public static function macro($name, $macro)
{
\Collective\Html\HtmlBuilder::macro($name, $macro);
}
示例4: function
<?php
use App\Events;
use App\Hooks;
use Collective\Html\HtmlBuilder as Html;
Html::macro("Hook", function ($name = null, $param = null) {
if ($name) {
try {
Event::Fire(new Hooks\Handler($name, $param));
} catch (Exception $e) {
}
}
});