Skip to content
Snippets Groups Projects
Commit 501cf505 authored by Tim Wagner's avatar Tim Wagner
Browse files

[TASK] Create backend preview for listByCategory news plugin

parent 6d06b400
No related branches found
No related tags found
1 merge request!24[FEATURE] Plugin Backend Previews
......@@ -92,6 +92,37 @@ class PluginRenderer implements PageLayoutViewDrawItemHookInterface {
$templateData = [
'limit' => $pluginConfiguration['settings.limit']['vDEF'],
'categories' => $this->addTitlesToRecordIdList(
'pages',$pluginConfiguration['settings.categories']['vDEF'] ?? ''
),
'tags' => $this->addTitlesToRecordIdList(
'sys_category', $pluginConfiguration['settings.tags']['vDEF'] ?? ''
),
'starttime' => $pluginConfiguration['settings.starttime']['vDEF'],
'endtime' => $pluginConfiguration['settings.endtime']['vDEF'],
'sortBy' => $pluginConfiguration['settings.sortBy']['vDEF']
];
$view->assign('data', $templateData);
$itemContent .= $view->render();
break;
case 'sgnews_listbycategory':
$drawItem = FALSE;
$view = $this->createViewWithTemplate('ListByCategory');
$view->assign('uid', $row['uid']);
$this->adaptPluginHeaderContent($headerContent, $row);
// Get available plugin settings and their values from flexform
$pluginConfiguration = GeneralUtility::xml2array(
$row['pi_flexform'], 'T3DataStructure'
)['data']['main']['lDEF'];
$templateData = [
'newsLimitPerPage' => $pluginConfiguration['settings.newsLimitPerPage']['vDEF'],
'categories' => $this->addTitlesToRecordIdList(
'pages',$pluginConfiguration['settings.categories']['vDEF']
),
......@@ -100,13 +131,15 @@ class PluginRenderer implements PageLayoutViewDrawItemHookInterface {
),
'starttime' => $pluginConfiguration['settings.starttime']['vDEF'],
'endtime' => $pluginConfiguration['settings.endtime']['vDEF'],
'sortBy' => $pluginConfiguration['settings.sortBy']['vDEF']
'sortBy' => $pluginConfiguration['settings.sortBy']['vDEF'],
'sortDirection' => $pluginConfiguration['settings.sortDirection']['vDEF']
];
$view->assign('data', $templateData);
$itemContent .= $view->render();
break;
default:
// No need to do anything
}
......
{namespace be=TYPO3\CMS\Backend\ViewHelpers}
<f:debug>{data}</f:debug>
<be:link.editRecord table="tt_content" uid="{uid}">
<br/>
......
{namespace be=TYPO3\CMS\Backend\ViewHelpers}
<be:link.editRecord table="tt_content" uid="{uid}">
<br/>
<table class="table table-striped table-bordered">
<f:render partial="PluginDataTableHeader"/>
<tbody>
<tr>
<th scope="row">
<f:translate
key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.latest.flexForm.newsLimit"/>
</th>
<td>
{data.newsLimitPerPage}
</td>
</tr>
<f:comment><!-- Always rendered because having no categories means there is no frontend output. --></f:comment>
<tr>
<th scope="row">
<f:translate
key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.listByCategory.flexForm.categories"/>
</th>
<td>
{data.categories}
</td>
</tr>
<f:if condition="{data.tags}">
<tr>
<th scope="row">
<f:translate
key="LLL:EXT:sg_news/Resources/Private/Language/locallang_backend.xlf:plugin.preview.latest.tags"/>
</th>
<td>
{data.tags}
</td>
</tr>
</f:if>
<f:if condition="{data.starttime}">
<tr>
<th scope="row">
<f:translate
key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.starttime"/>
</th>
<td>
<f:format.date format="d.m.Y">{data.starttime}</f:format.date>
</td>
</tr>
</f:if>
<f:if condition="{data.endtime}">
<tr>
<th scope="row">
<f:translate
key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.endtime"/>
</th>
<td>
<f:format.date format="d.m.Y">{data.endtime}</f:format.date>
</td>
</tr>
</f:if>
<tr>
<th scope="row">
<f:translate
key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.sortBy"/>
</th>
<td>
<f:switch expression="{data.sortBy}">
<f:case value="typoscript">
<f:translate key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.systemDefault"/>
</f:case>
<f:case value="date">
<f:translate key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.dateOfPublication"/>
</f:case>
<f:case value="positionInTree">
<f:translate key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.orderInPageTree"/>
</f:case>
</f:switch>
</td>
</tr>
<tr>
<th scope="row">
<f:translate
key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.sortOrder"/>
</th>
<td>
<f:switch expression="{data.sortDirection}">
<f:case value="typoscript">
<f:translate key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.systemDefault"/>
</f:case>
<f:case value="DESC">
<f:translate key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.desc"/>
</f:case>
<f:case value="ASC">
<f:translate key="LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.asc"/>
</f:case>
</f:switch>
</td>
</tr>
</tbody>
</table>
</be:link.editRecord>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment