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;
 }
 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);
 }
 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');
 }
 public static function loading($content, $title = null, $timeOut = null, $extendedTimeOut = null)
 {
     return parent::create($content, StatusMessageTypes::LOADING, $title, $timeOut, $extendedTimeOut);
 }
 public function getColumnContent($grid, $record, $col)
 {
     return ViewableData::create()->renderWith('GridFieldOrderableRowsDragHandle');
 }
 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');
 }