Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Silverstripe 4中获得可能的模板候选列表?_Silverstripe_Silverstripe 4 - Fatal编程技术网

如何在Silverstripe 4中获得可能的模板候选列表?

如何在Silverstripe 4中获得可能的模板候选列表?,silverstripe,silverstripe-4,Silverstripe,Silverstripe 4,在开发SilverStripe 4项目时,我发现获得给定覆盖的所有可能候选项的列表有些复杂 因此,我的问题是: 如何获取给定页面的可能模板候选的完整列表?在控制器中,您可以在控制器本身或数据记录上调用方法getViewerTemplates,因为getViewerTemplates是ViewableData上的方法 $this->dataRecord->getViewerTemplates(); $this->dataRecord->getViewerTemplates(

在开发SilverStripe 4项目时,我发现获得给定覆盖的所有可能候选项的列表有些复杂

因此,我的问题是:


如何获取给定页面的可能模板候选的完整列表?

在控制器中,您可以在控制器本身或
数据记录上调用方法
getViewerTemplates
,因为
getViewerTemplates
ViewableData
上的方法

$this->dataRecord->getViewerTemplates();
$this->dataRecord->getViewerTemplates($action); //If you're calling an action
$this->getViewerTemplates(); //If you don't have a datarecord
实际上,所有这些都是在
SSViewer
上实现的方法
我想它会回报你所需要的