如何解决Typo3 8.7从TCA覆盖页面返回GLOBAL be_user值
我创建了一个新的后端变量,称为“ userval”。 我可以在任何控制器中通过简单的调用来引用该值:
$GLOBALS['BE_USER']->user['userval']
但是,我需要通过TCA / Overrides / tt_content.PHP页面从另一个扩展中获取此值。上面的代码在这里不起作用(我收到一个空值)。是否可以从tt_content.PHP访问BE_USER值?
解决方法
更新-我没有设法弄清楚,但是我找到了一个更好的解决方案,可能对其他人有用。
我需要此信息,因为我想从链接到“ userval”字段的表中返回项目列表。但是下面的示例已简化为更通用。.
我发现tt_content.php可以通过控制器将数据直接传递给它。在tt_content.php文件中,添加以下内容:
Dim myChart As Graph.Chart
Dim myChartSeries As Graph.Series
Dim mySeriesDataLabel As Graph.DataLabel
Set myChart = Me.myGraph.Object
For Each myChartSeries In myChart.SeriesCollection
For Each mySeriesDataLabel In myChartSeries.DataLabels
mySeriesDataLabel.Font.Name = "Times New Roman"
mySeriesDataLabel.Font.FontStyle = "Normal"
mySeriesDataLabel.Font.Size = 8
Next mySeriesDataLabel
Next myChartSeries
With Me.myGraph.Axes(1).TickLabels.Font
.Name = "Times New Romans"
.FontStyle = "Normal"
.Size = 8
End With
With Me.myGraph.Axes(2).TickLabels.Font
.Name = "Times New Romans"
.FontStyle = "Normal"
.Size = 8
End With
),
...请注意“ itemsProcFunc”行。这引用了ExampleController返回的数据。
在ExampleController中,这是将数据发送到tt_content.php中的方法:
'tx_some_example' =>
array(
'config' =>
array(
'type' => 'select','renderType' => 'selectSingle','items' => array (),'itemsProcFunc' => 'SomeDomain\SomeExtensionName\Controller\ExampleController->getItems','selicon_cols' => 8,'size' => 1,'minitems' => 0,'maxitems' => 1,),'exclude' => '1','label' => 'Some example',
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。