show registered export renderers in admin submit without required tpl block extension

This commit is contained in:
Daniel Seifert 2021-10-29 11:37:51 +02:00
parent 500f226399
commit e1502b274e
Signed by: DanielS
GPG Key ID: 8A7C4C6ED1915C6F
6 changed files with 51 additions and 7 deletions

View File

@ -103,7 +103,15 @@ abstract class ExportBase implements QueryBase
*/
public function getRenderer($format): ExportRenderer\RendererInterface
{
return oxNew(RendererBridge::class)->getRenderer($format);
return $this->getRendererBridge()->getRenderer($format);
}
/**
* @return RendererBridge
*/
public function getRendererBridge()
{
return oxNew(RendererBridge::class);
}
/**

View File

@ -74,4 +74,12 @@ class Csv implements RendererInterface
return $csv;
}
/**
* @return string
*/
public function getTitleTranslationId(): string
{
return 'D3_DATAWIZARD_EXPORT_FORMAT_CSV';
}
}

View File

@ -38,4 +38,12 @@ class Pretty implements RendererInterface
{
return 'txt';
}
/**
* @return string
*/
public function getTitleTranslationId(): string
{
return "D3_DATAWIZARD_EXPORT_FORMAT_PRETTY";
}
}

View File

@ -33,6 +33,21 @@ class RendererBridge
];
}
public function getTranslatedRendererIdList()
{
$rendererList = $this->getRendererList();
array_walk($rendererList, [$this, 'translateRendererId']);
return $rendererList;
}
/**
* @param RendererInterface $instance
*/
protected function translateRendererId(RendererInterface &$instance)
{
$instance = $instance->getTitleTranslationId();
}
/**
* @param string $format
*

View File

@ -29,4 +29,9 @@ interface RendererInterface
* @return string
*/
public function getFileExtension() : string;
/**
* @return string
*/
public function getTitleTranslationId() : string;
}

View File

@ -11,12 +11,12 @@
</button>
<div class="dropdown-menu">
[{block name="dataWizardFormat"}]
<button class="dropdown-item" onclick="startTask('[{$id}]', 'CSV')">
[{oxmultilang ident="D3_DATAWIZARD_EXPORT_FORMAT_CSV"}]
</button>
<button class="dropdown-item" onclick="startTask('[{$id}]', 'Pretty')">
[{oxmultilang ident="D3_DATAWIZARD_EXPORT_FORMAT_PRETTY"}]
[{assign var="rendererBridge" value=$item->getRendererBridge()}]
[{foreach from=$rendererBridge->getTranslatedRendererIdList() key="key" item="translationId"}]
<button class="dropdown-item" onclick="startTask('[{$id}]', '[{$key}]')">
[{oxmultilang ident=$translationId}]
</button>
[{/foreach}]
[{/block}]
</div>
</div>