当前位置: 首页>>代码示例>>PHP>>正文


PHP SSViewer::get_templates_by_class方法代码示例

本文整理汇总了PHP中SSViewer::get_templates_by_class方法的典型用法代码示例。如果您正苦于以下问题:PHP SSViewer::get_templates_by_class方法的具体用法?PHP SSViewer::get_templates_by_class怎么用?PHP SSViewer::get_templates_by_class使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SSViewer的用法示例。


在下文中一共展示了SSViewer::get_templates_by_class方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getMappableMapContent

 /**
  * Renders the map info window for the DataObject.
  *
  * Be sure to define a template for that, named by the decorated class suffixed with _MapInfoWindow
  * e.g. MyPage_MapInfoWindow
  *
  * You can change the suffix globally by editing the MapExtension.map_info_window_suffix config val
  *
  * @return string
  */
 public function getMappableMapContent()
 {
     $defaultTemplate = 'MapInfoWindow';
     $classTemplate = SSViewer::get_templates_by_class($this->owner->ClassName, Config::inst()->get('MapExtension', 'map_info_window_suffix'));
     $template = count($classTemplate) ? $classTemplate : $defaultTemplate;
     return MapUtil::sanitize($this->owner->renderWith($template));
 }
开发者ID:helpfulrobot,项目名称:weboftalent-mappable,代码行数:17,代码来源:MapExtension.php

示例2: show

 /**
  * action for showing a single news item
  */
 public function show()
 {
     $templates = SSViewer::get_templates_by_class(__CLASS__, '_show');
     $templates[] = 'Page';
     //use this if you need e.g. different template for ajax
     $this->extend('updateTemplatesForShowAction', $templates);
     return $this->renderWith($templates);
 }
开发者ID:helpfulrobot,项目名称:wernerkrauss-silverstripe-casestudies,代码行数:11,代码来源:CaseStudyHolder.php

示例3: LayoutSection

 /**
  * Render this Page for $LayoutSection
  * @return \HTMLText
  */
 public function LayoutSection()
 {
     $templates = SSViewer::get_templates_by_class(get_class($this), '', 'SiteTree');
     foreach ($templates as &$template) {
         $template = "Section/{$template}";
     }
     return $this->renderWith(new SSViewer($templates));
 }
开发者ID:silverstripe-europe-meetup,项目名称:website-2015,代码行数:12,代码来源:SectionBase.php

示例4: getTemplatesWithSuffix

 /**
  * Return a list of appropriate templates for this class, with the given suffix using 
  * {@link SSViewer::get_templates_by_class()}
  *
  * @return array
  */
 public function getTemplatesWithSuffix($suffix)
 {
     return SSViewer::get_templates_by_class(get_class($this), $suffix, 'LeftAndMain');
 }
开发者ID:jakedaleweb,项目名称:AtomCodeChallenge,代码行数:10,代码来源:LeftAndMain.php

示例5: testGetTemplatesByClass

 /**
  * @covers SSViewer::get_templates_by_class()
  */
 public function testGetTemplatesByClass()
 {
     $self = $this;
     $this->useTestTheme('layouttest', function () use($self) {
         // Test passing a string
         $templates = SSViewer::get_templates_by_class('SSViewerTest_Controller', '', 'Controller');
         $self->assertCount(2, $templates);
         // Test to ensure we're stopping at the base class.
         $templates = SSViewer::get_templates_by_class('SSViewerTest_Controller', '', 'SSViewerTest_Controller');
         $self->assertCount(1, $templates);
         // Make sure we can filter our templates by suffix.
         $templates = SSViewer::get_templates_by_class('SSViewerTest', '_Controller');
         $self->assertCount(1, $templates);
         // Test passing a valid object
         $templates = SSViewer::get_templates_by_class("SSViewerTest_Controller", '', 'Controller');
         // Test that templates are returned in the correct order
         $self->assertEquals('SSViewerTest_Controller', array_shift($templates));
         $self->assertEquals('Controller', array_shift($templates));
         // Let's throw something random in there.
         $self->setExpectedException('InvalidArgumentException');
         $templates = SSViewer::get_templates_by_class(array());
         $this->assertCount(0, $templates);
     });
 }
开发者ID:fanggu,项目名称:loveyourwater_ss_v3.1.6,代码行数:27,代码来源:SSViewerTest.php

示例6: getViewer

 /**
  * Return an SSViewer object to render the template for the current page.
  *
  * @param $action string
  *
  * @return SSViewer
  */
 public function getViewer($action)
 {
     // Manually set templates should be dealt with by Controller::getViewer()
     if (isset($this->templates[$action]) && $this->templates[$action] || isset($this->templates['index']) && $this->templates['index'] || $this->template) {
         return parent::getViewer($action);
     }
     // Prepare action for template search
     if ($action == "index") {
         $action = "";
     } else {
         $action = '_' . $action;
     }
     $templates = array_merge(SSViewer::get_templates_by_class(get_class($this->dataRecord), $action, "SiteTree"), SSViewer::get_templates_by_class(get_class($this), $action, "Controller"), SSViewer::get_templates_by_class(get_class($this->dataRecord), "", "SiteTree"), SSViewer::get_templates_by_class(get_class($this), "", "Controller"));
     return new SSViewer($templates);
 }
开发者ID:helpfulrobot,项目名称:comperio-silverstripe-cms,代码行数:22,代码来源:ContentController.php

示例7: getViewer

 /**
  * Return an SSViewer object to render the template for the current page.
  *
  * @param $action string
  *
  * @return SSViewer
  */
 public function getViewer($action)
 {
     // Manually set templates should be dealt with by Controller::getViewer()
     if (isset($this->templates[$action]) && $this->templates[$action] || isset($this->templates['index']) && $this->templates['index'] || $this->template) {
         return parent::getViewer($action);
     }
     // Prepare action for template search
     if ($action == "index") {
         $action = "";
     } else {
         $action = '_' . $action;
     }
     // Find templates by dataRecord
     $templates = SSViewer::get_templates_by_class(get_class($this->dataRecord), $action, "SiteTree");
     // Next, we need to add templates for all controllers
     $templates += SSViewer::get_templates_by_class(get_class($this), $action, "Controller");
     // Fail-over to the same for the "index" action
     $templates += SSViewer::get_templates_by_class(get_class($this->dataRecord), "", "SiteTree");
     $templates += SSViewer::get_templates_by_class(get_class($this), "", "Controller");
     return new SSViewer($templates);
 }
开发者ID:Neumes,项目名称:silverstripe-cms,代码行数:28,代码来源:ContentController.php

示例8: testGetTemplatesByClass

 /**
  * @covers SSViewer::get_templates_by_class()
  */
 public function testGetTemplatesByClass()
 {
     $self = $this;
     $this->useTestTheme(dirname(__FILE__), 'layouttest', function () use($self) {
         // Test passing a string
         $templates = SSViewer::get_templates_by_class('TestNamespace\\SSViewerTestModel_Controller', '', 'Controller');
         $self->assertEquals(['TestNamespace\\SSViewerTestModel_Controller', 'Controller'], $templates);
         // Test to ensure we're stopping at the base class.
         $templates = SSViewer::get_templates_by_class('TestNamespace\\SSViewerTestModel_Controller', '', 'TestNamespace\\SSViewerTestModel_Controller');
         $self->assertCount(1, $templates);
         // Make sure we can filter our templates by suffix.
         $templates = SSViewer::get_templates_by_class('TestNamespace\\SSViewerTestModel', '_Controller');
         $self->assertCount(1, $templates);
         // Let's throw something random in there.
         $self->setExpectedException('InvalidArgumentException');
         $templates = SSViewer::get_templates_by_class(array());
     });
 }
开发者ID:jacobbuck,项目名称:silverstripe-framework,代码行数:21,代码来源:SSViewerTest.php

示例9: getOnePageContent

 /**
  * renders the current page using the ClassName_onepage template,
  * e.g. Page_onepage
  *
  * The suffix is generated by @link getOnePageTemplateSuffix
  *
  * @return HTMLText
  */
 public function getOnePageContent()
 {
     $templateName = SSViewer::get_templates_by_class($this->owner->Classname, $this->getOnePageTemplateSuffix(), 'SiteTree') ?: 'Page_onepage';
     $controller = ModelAsController::controller_for($this->owner);
     return $controller->renderWith($templateName);
 }
开发者ID:wernerkrauss,项目名称:silverstripe-onepage,代码行数:14,代码来源:OnePageSlide.php


注:本文中的SSViewer::get_templates_by_class方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。