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


PHP ViewableData::create方法代碼示例

本文整理匯總了PHP中ViewableData::create方法的典型用法代碼示例。如果您正苦於以下問題:PHP ViewableData::create方法的具體用法?PHP ViewableData::create怎麽用?PHP ViewableData::create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ViewableData的用法示例。


在下文中一共展示了ViewableData::create方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: get_navbar_html

 public static function get_navbar_html($page = null)
 {
     // remove the protocol from the URL, otherwise we run into https/http issues
     $url = self::remove_protocol_from_url(self::get_toolbar_hostname());
     $static = true;
     if (!$page instanceof SiteTree) {
         $page = Director::get_current_page();
         $static = false;
     }
     // In some cases, controllers are bound to "mock" pages, like Security. In that case,
     // throw the "default section" as the current controller.
     if (!$page instanceof SiteTree || !$page->isInDB()) {
         $controller = ModelAsController::controller_for($page = SiteTree::get_by_link(Config::inst()->get('GlobalNav', 'default_section')));
     } else {
         // Use controller_for to negotiate sub controllers, e.g. /showcase/listing/slug
         // (Controller::curr() would return the nested RequestHandler)
         $controller = ModelAsController::controller_for($page);
     }
     // Ensure staging links are not exported to the nav
     $origStage = Versioned::current_stage();
     Versioned::reading_stage('Live');
     $html = ViewableData::create()->customise(array('ToolbarHostname' => $url, 'Scope' => $controller, 'ActivePage' => $page, 'ActiveParent' => $page instanceof SiteTree && $page->Parent()->exists() ? $page->Parent() : $page, 'StaticRender' => $static, 'GoogleCustomSearchId' => Config::inst()->get('GlobalNav', 'google_search_id')))->renderWith('GlobalNavbar');
     Versioned::reading_stage($origStage);
     return $html;
 }
開發者ID:newleeland,項目名稱:silverstripe-globaltoolbar,代碼行數:25,代碼來源:GlobalNavSiteTreeExtension.php

示例2: create_nav

 public static function create_nav()
 {
     // remove the protocol from the URL, otherwise we run into https/http issues
     $url = self::remove_protocol_from_url(self::get_toolbar_hostname());
     $html = ViewableData::create()->customise(array('ToolbarHostname' => $url, 'Pages' => SiteTree::get()->filter(array('ParentID' => 0, 'ShowInGlobalNav' => true)), 'GoogleCustomSearchId' => Config::inst()->get('GlobalNav', 'google_search_id')))->renderWith('GlobalNavbar');
     $path = Config::inst()->get('GlobalNav', 'snippet_path');
     file_put_contents(BASE_PATH . $path, $html);
 }
開發者ID:stojg,項目名稱:silverstripe-globaltoolbar,代碼行數:8,代碼來源:GlobalNavSiteTreeExtension.php

示例3: get_navbar_html

 public static function get_navbar_html($page = null)
 {
     // remove the protocol from the URL, otherwise we run into https/http issues
     $url = self::remove_protocol_from_url(self::get_toolbar_hostname());
     $static = true;
     if (!$page instanceof SiteTree) {
         $page = Director::get_current_page();
         $static = false;
     }
     return ViewableData::create()->customise(array('ToolbarHostname' => $url, 'Pages' => SiteTree::get()->filter(array('ParentID' => 0, 'ShowInGlobalNav' => true)), 'ActivePage' => $page, 'ActiveParent' => $page instanceof SiteTree && $page->Parent()->exists() ? $page->Parent() : $page, 'StaticRender' => $static, 'GoogleCustomSearchId' => Config::inst()->get('GlobalNav', 'google_search_id')))->renderWith('GlobalNavbar');
 }
開發者ID:edlinklater,項目名稱:silverstripe-globaltoolbar,代碼行數:11,代碼來源:GlobalNavSiteTreeExtension.php

示例4: loading

 public static function loading($content, $title = null, $timeOut = null, $extendedTimeOut = null)
 {
     return parent::create($content, StatusMessageTypes::LOADING, $title, $timeOut, $extendedTimeOut);
 }
開發者ID:helpfulrobot,項目名稱:gdmedia-silverstripe-status-message,代碼行數:4,代碼來源:StatusMessage.php

示例5: getColumnContent

 public function getColumnContent($grid, $record, $col)
 {
     return ViewableData::create()->renderWith('GridFieldOrderableRowsDragHandle');
 }
開發者ID:helpfulrobot,項目名稱:ajshort-silverstripe-gridfieldextensions,代碼行數:4,代碼來源:GridFieldOrderableRows.php

示例6: getColumnContent

 public function getColumnContent($grid, $record, $col)
 {
     // In case you are using GridFieldEditableColumns, this ensures that
     // the correct sort order is saved. If you are not using that component,
     // this will be ignored by other components, but will still work for this.
     $sortFieldName = sprintf('%s[GridFieldEditableColumns][%s][%s]', $grid->getName(), $record->ID, $this->getSortField());
     $sortField = new HiddenField($sortFieldName, false, $record->getField($this->getSortField()));
     $sortField->addExtraClass('ss-orderable-hidden-sort');
     $sortField->setForm($grid->getForm());
     return ViewableData::create()->customise(array('SortField' => $sortField))->renderWith('GridFieldOrderableRowsDragHandle');
 }
開發者ID:ajshort,項目名稱:silverstripe-gridfieldextensions,代碼行數:11,代碼來源:GridFieldOrderableRows.php


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