本文整理汇总了PHP中Cms\Classes\Theme::getEditTheme方法的典型用法代码示例。如果您正苦于以下问题:PHP Theme::getEditTheme方法的具体用法?PHP Theme::getEditTheme怎么用?PHP Theme::getEditTheme使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cms\Classes\Theme
的用法示例。
在下文中一共展示了Theme::getEditTheme方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor.
*/
public function __construct()
{
parent::__construct();
BackendMenu::setContext('RainLab.Pages', 'pages', 'pages');
try {
if (!($this->theme = Theme::getEditTheme())) {
throw new ApplicationException(Lang::get('cms::lang.theme.edit.not_found'));
}
new PageList($this, 'pageList');
new MenuList($this, 'menuList');
new SnippetList($this, 'snippetList');
$theme = $this->theme;
new TemplateList($this, 'contentList', function () use($theme) {
return Content::listInTheme($theme, true);
});
} catch (Exception $ex) {
$this->handleError($ex);
}
$this->addJs('/modules/backend/assets/js/october.treeview.js', 'core');
$this->addJs('/plugins/rainlab/pages/assets/js/pages-page.js');
$this->addJs('/plugins/rainlab/pages/assets/js/pages-snippets.js');
$this->addCss('/plugins/rainlab/pages/assets/css/pages.css');
// Preload the code editor class as it could be needed
// before it loads dynamically.
$this->addJs('/modules/backend/formwidgets/codeeditor/assets/js/codeeditor.js', 'core');
$this->bodyClass = 'compact-container side-panel-not-fixed';
$this->pageTitle = 'rainlab.pages::lang.plugin.name';
$this->pageTitleTemplate = '%s Pages';
}
示例2: __construct
/**
* Constructor.
*/
public function __construct()
{
parent::__construct();
BackendMenu::setContext('October.Cms', 'cms', true);
try {
if (!($theme = Theme::getEditTheme())) {
throw new ApplicationException(Lang::get('cms::lang.theme.edit.not_found'));
}
$this->theme = $theme;
new TemplateList($this, 'pageList', function () use($theme) {
return Page::listInTheme($theme, true);
});
new TemplateList($this, 'partialList', function () use($theme) {
return Partial::listInTheme($theme, true);
});
new TemplateList($this, 'layoutList', function () use($theme) {
return Layout::listInTheme($theme, true);
});
new TemplateList($this, 'contentList', function () use($theme) {
return Content::listInTheme($theme, true);
});
new ComponentList($this, 'componentList');
new AssetList($this, 'assetList');
} catch (Exception $ex) {
$this->handleError($ex);
}
}
示例3: __construct
public function __construct($controller, $alias)
{
$this->alias = $alias;
$this->theme = Theme::getEditTheme();
$this->dataIdPrefix = 'page-' . $this->theme->getDirName();
parent::__construct($controller, []);
$this->bindToController();
}
示例4: __construct
public function __construct($controller, $alias)
{
$this->alias = $alias;
$this->theme = Theme::getEditTheme();
parent::__construct($controller, []);
$this->bindToController();
$this->checkUploadPostback();
}
示例5: afterFetch
/**
* Restore the CMS page found in the mapping array, or disable the
* maintenance mode.
* @return void
*/
public function afterFetch()
{
if (($theme = Theme::getEditTheme()) && ($themeMap = array_get($this->attributes, 'theme_map')) && ($cmsPage = array_get($themeMap, $theme->getDirName()))) {
$this->cms_page = $cmsPage;
} else {
$this->is_enabled = false;
}
}
示例6: getCodeOptions
public function getCodeOptions()
{
$result = [];
$theme = Theme::getEditTheme();
$menus = PagesMenu::listInTheme($theme, true);
foreach ($menus as $menu) {
$result[$menu->code] = $menu->name;
}
return $result;
}
示例7: getTemplateScriptPath
protected function getTemplateScriptPath()
{
$theme = Theme::getEditTheme();
$assetPath = $theme->getPath() . '/assets';
$fileName = $this->template->getBaseFileName();
$jsPath = $assetPath . '/javascript';
if (!File::isDirectory($jsPath)) {
$jsPath = $assetPath . '/js';
}
return $jsPath . '/controllers/' . $fileName . '.js';
}
示例8: getPagesDropDown
public function getPagesDropDown()
{
if (!$this->pages) {
$theme = Theme::getEditTheme();
$pages = Page::listInTheme($theme, true);
$this->pages = [];
foreach ($pages as $page) {
$this->pages[$page->baseFileName] = $page->title . ' (' . $page->url . ')';
}
}
return $this->pages;
}
示例9: partials
public function partials()
{
if (!$this->partials) {
$theme = Theme::getEditTheme();
$partials = Prtl::listInTheme($theme, true);
$options = [];
foreach ($partials as $partial) {
$options[$partial->baseFileName] = $partial->baseFileName;
}
asort($options);
$this->partials = $options;
}
return $this->partials;
}
示例10: __construct
public function __construct()
{
parent::__construct();
BackendMenu::setContext('JofrySutanto.CustomFields', 'customfields', 'customfields');
try {
if (!($this->theme = Theme::getEditTheme())) {
throw new ApplicationException(Lang::get('cms::lang.theme.edit.not_found'));
}
new FieldGroupList($this, 'groupList');
$theme = $this->theme;
} catch (Exception $ex) {
$this->handleError($ex);
}
}
示例11: getLayoutOptions
/**
* Returns a list of layouts available in the theme.
* This method is used by the form widget.
* @return array Returns an array of strings.
*/
public function getLayoutOptions()
{
if (!($theme = Theme::getEditTheme())) {
throw new ApplicationException(Lang::get('cms::lang.theme.edit.not_found'));
}
$layouts = Layout::listInTheme($theme, true);
$result = [];
$result[null] = Lang::get('cms::lang.page.no_layout');
foreach ($layouts as $layout) {
$baseName = $layout->getBaseFileName();
$result[$baseName] = strlen($layout->name) ? $layout->name : $baseName;
}
return $result;
}
示例12: listPages
private static function listPages()
{
if (!($theme = Theme::getEditTheme())) {
throw new ApplicationException(Lang::get('cms::lang.theme.edit.not_found'));
}
$pages = Page::listInTheme($theme, true);
$result = [];
foreach ($pages as $page) {
if ($page->show_menu == "1") {
$result[$page->menu_order] = ['text' => $page->menu_text, 'path' => $page->getBaseFileName(), 'order' => $page->menu_order];
}
}
ksort($result);
return $result;
}
示例13: onRun
public function onRun()
{
if (!($theme = Theme::getEditTheme())) {
throw new ApplicationException(Lang::get('cms::lang.theme.edit.not_found'));
}
$currentPage = $this->page->baseFileName;
$pages = Page::listInTheme($theme, true);
$this->pagesList = $this->buildPagesList($pages);
$breadcrumbList = $this->buildCrumbTrail($currentPage);
$currentCrumb = array_slice($breadcrumbList, -1, 1, true);
$currentCrumb = array_shift($currentCrumb);
$this->page['breadcrumbs'] = $breadcrumbList;
$this->page['currentCrumb'] = $currentCrumb;
return;
}
示例14: getPageUrlOptions
public function getPageUrlOptions()
{
$currentTheme = Theme::getEditTheme();
$allThemePages = Page::listInTheme($currentTheme, true);
$options = [];
foreach ($allThemePages as $p) {
$options['url=' . $p->url . '&type=cms_pages'] = $p->title;
}
$tree = StaticPageClass::buildMenuTree($currentTheme);
foreach ($tree as $key => $page) {
if (isset($page['title']) && isset($page['url'])) {
$options['url=' . $page['url'] . '&type=pages_plugin'] = $page['title'];
}
}
return $options;
}
示例15: register
public function register()
{
\Event::listen('backend.form.extendFields', function ($widget) {
if (!$widget->model instanceof \Cms\Classes\Page) {
return;
}
if (!($theme = Theme::getEditTheme())) {
throw new ApplicationException(Lang::get('cms::lang.theme.edit.not_found'));
}
$pages = Page::all()->sort(function ($a, $b) {
return strcasecmp($a->title, $b->title);
});
$pageOptions = $this->buildPageOptions($pages);
$widget->addFields(['settings[child_of]' => ['label' => 'Child Of', 'type' => 'dropdown', 'tab' => 'Breadcrumbs', 'span' => 'left', 'options' => $pageOptions, 'comment' => 'The parent of this page. Set to "None" if root page'], 'settings[hide_crumb]' => ['label' => 'Hide Breadcrumbs', 'type' => 'checkbox', 'tab' => 'Breadcrumbs', 'span' => 'right', 'comment' => 'Hide the breadcrumb trail on this page'], 'settings[crumb_title]' => ['label' => 'Crumb Title (Optional)', 'type' => 'text', 'tab' => 'Breadcrumbs', 'span' => 'left', 'comment' => 'Title text for this pages crumb, by default will use page title'], 'settings[remove_crumb_trail]' => ['label' => 'Remove From Breadcrumbs', 'type' => 'checkbox', 'tab' => 'Breadcrumbs', 'span' => 'right', 'comment' => 'Do not show this page in the breadcrumb trail'], 'settings[crumbElementTitle]' => ['label' => 'Crumb Title From Id (Optional)', 'type' => 'text', 'tab' => 'Breadcrumbs', 'span' => 'left', 'comment' => 'Use a DOM element as the crumb title for this page. Must be a a unique #id on the page.'], 'settings[crumb_disabled]' => ['label' => 'Disabled', 'type' => 'checkbox', 'tab' => 'Breadcrumbs', 'span' => 'right', 'comment' => 'Disable the link and add the disabled class to this crumb item in the breadcrumb list']], 'primary');
});
}