本文整理汇总了PHP中Component::register方法的典型用法代码示例。如果您正苦于以下问题:PHP Component::register方法的具体用法?PHP Component::register怎么用?PHP Component::register使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Component
的用法示例。
在下文中一共展示了Component::register方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: register
public function register()
{
parent::register();
$vcMapping = $this->getVcMappingArgs();
$this->createContainerClassIfIsNeeded($vcMapping);
add_action('vc_before_init', function () use($vcMapping) {
vc_map($vcMapping);
});
}
示例2: function
/**
* Created by Miki Maine Amdu.
* For : INNOVATE E-COMMERCE
* User: MIKI$
* Date: 6/22/2016
* Time: 9:45 PM.
*/
\Component::register('category', function () {
return \Theme::view('includes.partials._category');
});
\Component::register('sellers', function () {
return \Theme::view('includes.partials._sellers');
});
\Component::register('shopping_cart', function () {
return \Theme::view('includes.partials._shopping_cart');
});
\Component::register('google_analytics', function () {
return \Theme::view('includes.partials.ga');
});
\Component::register('search', function () {
return \Theme::view('includes.partials.search');
});
\Component::register('tags', function () {
return \Theme::view('includes.partials._tags');
});
\Component::register('cart_summary', function () {
return \Theme::view('includes.partials._cart_summary');
});
\Component::register('shipping_calculator', function () {
return \Theme::view('includes.partials._shipping_calculator');
});
示例3: function
use Volrac\YppContent\Models\Site;
use Volrac\YppContent\Models\Area;
use Volrac\YppContent\Models\Advertisement;
\Component::register('advertisement', function ($area, $site_id = null) {
$advertisement = '';
$area = Area::where('slug', $area)->first();
// Invalid Area
if (!$area) {
return $advertisement;
}
$site = Site::where('name', $site_id)->first();
if (!$site) {
$site = Site::where('domain', $site_id)->first();
}
if (!$site) {
$site = Site::find($site_id);
}
// Limited to Only 1 Site
if ($site && !empty($area->site_ids) && in_array($site->id, $area->site_ids)) {
$advertisement = $area->advertisements()->first();
$advertisement = $advertisement->show;
return $advertisement;
}
// If not Site provided
if ($site_id == null && empty($area->site_ids)) {
$advertisement = $area->advertisements()->orderBy(\DB::raw('RAND()'))->first();
$advertisement = $advertisement->show;
return $advertisement;
}
return $advertisement;
});