當前位置: 首頁>>代碼示例>>PHP>>正文


PHP HtmlBuilder::macro方法代碼示例

本文整理匯總了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')]);
 }
開發者ID:shnhrrsn,項目名稱:laravel-assets,代碼行數:35,代碼來源:ServiceProvider.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>';
     });
 }
開發者ID:WizzerOmega,項目名稱:webstock,代碼行數:8,代碼來源:HtmlFormServiceProvider.php

示例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);
 }
開發者ID:blargent,項目名稱:pimplot,代碼行數:12,代碼來源:_ide_helper.php

示例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) {
        }
    }
});
開發者ID:hakoncms,項目名稱:hakoncms,代碼行數:13,代碼來源:hooks.php


注:本文中的Collective\Html\HtmlBuilder::macro方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。