本文整理汇总了PHP中Backend\Classes\Controller::extend方法的典型用法代码示例。如果您正苦于以下问题:PHP Controller::extend方法的具体用法?PHP Controller::extend怎么用?PHP Controller::extend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Backend\Classes\Controller
的用法示例。
在下文中一共展示了Controller::extend方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: boot
public function boot()
{
Event::listen('backend.form.extendFields', function ($form) {
if ($form->model instanceof Backend\Models\BackendPreferences) {
$form->addFields(['focus_searchfield' => ['label' => 'indikator.backend::lang.settings.search_label', 'type' => 'switch', 'span' => 'left', 'default' => 'false', 'comment' => 'indikator.backend::lang.settings.search_comment'], 'sidebar_description' => ['label' => 'indikator.backend::lang.settings.sidebar_label', 'type' => 'switch', 'span' => 'right', 'default' => 'false', 'comment' => 'indikator.backend::lang.settings.sidebar_comment'], 'rounded_avatar' => ['label' => 'indikator.backend::lang.settings.avatar_label', 'type' => 'switch', 'span' => 'left', 'default' => 'false', 'comment' => 'indikator.backend::lang.settings.avatar_comment'], 'virtual_keyboard' => ['label' => 'indikator.backend::lang.settings.keyboard_label', 'type' => 'switch', 'span' => 'right', 'default' => 'false', 'comment' => 'indikator.backend::lang.settings.keyboard_comment'], 'media_menu' => ['label' => 'indikator.backend::lang.settings.media_label', 'type' => 'switch', 'span' => 'left', 'default' => 'false', 'comment' => 'indikator.backend::lang.settings.media_comment'], 'more_themes' => ['label' => 'indikator.backend::lang.settings.themes_label', 'type' => 'switch', 'span' => 'right', 'default' => 'false', 'comment' => 'indikator.backend::lang.settings.themes_comment']]);
}
});
BackendController::extend(function ($controller) {
if (BackendAuth::check()) {
$preferences = UserPreferences::forUser()->get('backend::backend.preferences');
if (isset($preferences['focus_searchfield']) && $preferences['focus_searchfield']) {
$controller->addJs('/plugins/indikator/backend/assets/js/setting-search.js');
}
if (isset($preferences['rounded_avatar']) && $preferences['rounded_avatar']) {
$controller->addCss('/plugins/indikator/backend/assets/css/rounded-avatar.css');
}
if (isset($preferences['virtual_keyboard']) && $preferences['virtual_keyboard']) {
$controller->addCss('/plugins/indikator/backend/assets/css/ml-keyboard.css');
$controller->addJs('/plugins/indikator/backend/assets/js/ml-keyboard.js');
}
if (isset($preferences['media_menu']) && $preferences['media_menu']) {
$controller->addCss('/plugins/indikator/backend/assets/css/media-menu.css');
}
if (isset($preferences['more_themes']) && $preferences['more_themes']) {
$controller->addJs('/plugins/indikator/backend/assets/js/setting-theme.js');
}
}
});
BackendMenu::registerContextSidenavPartial('October.System', 'system', '~/plugins/indikator/backend/partials/_system_sidebar.htm');
}
示例2: fixJs
public function fixJs()
{
BackendController::extend(function ($controller) {
// dd(LanguageDetector::isRtl());
if (!Request::ajax()) {
$controller->addJs(Config::get('cms.pluginsPath') . '/rtlweb/persian/assets/js/fix.inputpreset.js');
}
});
}
示例3: boot
public function boot()
{
Event::listen('backend.menu.extendItems', function ($manager) {
$manager->addMainMenuItems('October.Backend', ['dashboard' => ['icon' => 'icon-rocket']]);
});
BackendController::extend(function ($controller) {
$controller->addCss('/plugins/netsti/backend/assets/css/font.css');
$controller->addCss('/plugins/netsti/backend/assets/css/theme.css');
});
}
示例4: boot
public function boot()
{
if ((bool) File::get(base_path() . '/plugins/indikator/backend/assets/gzip.txt')) {
ob_start('ob_gzhandler');
}
Event::listen('backend.form.extendFields', function ($form) {
if ($form->model instanceof Backend\Models\Preference) {
$form->addTabFields(['rounded_avatar' => ['tab' => 'indikator.backend::lang.settings.tab_display', 'label' => 'indikator.backend::lang.settings.avatar_label', 'comment' => 'indikator.backend::lang.settings.avatar_comment', 'type' => 'switch', 'default' => false], 'topmenu_label' => ['tab' => 'indikator.backend::lang.settings.tab_display', 'label' => 'indikator.backend::lang.settings.topmenu_label', 'comment' => 'indikator.backend::lang.settings.topmenu_comment', 'type' => 'switch', 'default' => false], 'sidebar_description' => ['tab' => 'indikator.backend::lang.settings.tab_display', 'label' => 'indikator.backend::lang.settings.sidebar_desc_label', 'comment' => 'indikator.backend::lang.settings.sidebar_desc_comment', 'type' => 'switch', 'default' => false], 'sidebar_search' => ['tab' => 'indikator.backend::lang.settings.tab_display', 'label' => 'indikator.backend::lang.settings.sidebar_search_label', 'comment' => 'indikator.backend::lang.settings.sidebar_search_comment', 'type' => 'switch', 'default' => false], 'more_themes' => ['tab' => 'indikator.backend::lang.settings.tab_display', 'label' => 'indikator.backend::lang.settings.themes_label', 'comment' => 'indikator.backend::lang.settings.themes_comment', 'type' => 'switch', 'default' => false], 'focus_searchfield' => ['tab' => 'indikator.backend::lang.settings.tab_behavior', 'label' => 'indikator.backend::lang.settings.search_label', 'comment' => 'indikator.backend::lang.settings.search_comment', 'type' => 'switch', 'default' => false], 'context_menu' => ['tab' => 'indikator.backend::lang.settings.tab_behavior', 'label' => 'indikator.backend::lang.settings.context_menu_label', 'comment' => 'indikator.backend::lang.settings.context_menu_comment', 'type' => 'switch', 'default' => false], 'form_clearbutton' => ['tab' => 'indikator.backend::lang.settings.tab_behavior', 'label' => 'indikator.backend::lang.settings.clearbutton_label', 'comment' => 'indikator.backend::lang.settings.clearbutton_comment', 'type' => 'switch', 'default' => false], 'virtual_keyboard' => ['tab' => 'indikator.backend::lang.settings.tab_behavior', 'label' => 'indikator.backend::lang.settings.keyboard_label', 'comment' => 'indikator.backend::lang.settings.keyboard_comment', 'type' => 'switch', 'default' => false], 'enabled_gzip' => ['tab' => 'indikator.backend::lang.settings.tab_behavior', 'label' => 'indikator.backend::lang.settings.enabled_gzip_label', 'comment' => 'indikator.backend::lang.settings.enabled_gzip_comment', 'type' => 'switch', 'default' => false]]);
}
});
BackendController::extend(function ($controller) {
if (BackendAuth::check()) {
/*
* User settings
*/
$preferenceModel = class_exists('Backend\\Models\\UserPreference') ? Backend\Models\UserPreference::forUser() : Backend\Models\UserPreferences::forUser();
$preferences = $preferenceModel->get('backend::backend.preferences');
/*
* Display settings
*/
if (isset($preferences['rounded_avatar']) && $preferences['rounded_avatar']) {
$controller->addCss('/plugins/indikator/backend/assets/css/rounded-avatar.css');
}
if (isset($preferences['topmenu_label']) && $preferences['topmenu_label']) {
$controller->addCss('/plugins/indikator/backend/assets/css/topmenu-label.css');
$controller->addJs('/plugins/indikator/backend/assets/js/topmenu-label.js');
}
if (isset($preferences['sidebar_search']) && $preferences['sidebar_search']) {
$controller->addCss('/plugins/indikator/backend/assets/css/sidebar-search.css');
}
if (isset($preferences['sidebar_description']) && $preferences['sidebar_description']) {
$controller->addCss('/plugins/indikator/backend/assets/css/sidebar-description.css');
}
if (isset($preferences['more_themes']) && $preferences['more_themes']) {
$controller->addJs('/plugins/indikator/backend/assets/js/setting-theme.js');
}
/*
* Behavior settings
*/
if (isset($preferences['focus_searchfield']) && $preferences['focus_searchfield']) {
$controller->addCss('/plugins/indikator/backend/assets/css/setting-search.css');
$controller->addJs('/plugins/indikator/backend/assets/js/setting-search.js');
}
if (isset($preferences['context_menu']) && $preferences['context_menu']) {
$controller->addCss('/plugins/indikator/backend/assets/css/context-menu.css');
$controller->addJs('/plugins/indikator/backend/assets/js/context-menu.js');
}
if (isset($preferences['form_clearbutton']) && $preferences['form_clearbutton']) {
$controller->addJs('/plugins/indikator/backend/assets/js/form-clearbutton.js');
}
if (isset($preferences['virtual_keyboard']) && $preferences['virtual_keyboard']) {
$controller->addCss('/plugins/indikator/backend/assets/css/ml-keyboard.css');
$controller->addJs('/plugins/indikator/backend/assets/js/ml-keyboard.js');
}
if (isset($preferences['enabled_gzip']) && $preferences['enabled_gzip']) {
File::put(base_path() . '/plugins/indikator/backend/assets/gzip.txt', 1);
} else {
File::put(base_path() . '/plugins/indikator/backend/assets/gzip.txt', 0);
}
}
});
}