Remove special handling of tool templates

This commit is contained in:
Sebastian Meyer 2019-10-21 13:55:10 +02:00
parent 3d1f531786
commit 9a98cab212
7 changed files with 11 additions and 21 deletions

View File

@ -66,26 +66,16 @@ abstract class AbstractPlugin extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin
*
* @return void
*/
protected function getTemplate($part = '###TEMPLATE###', $directory = '', $tool = FALSE) {
protected function getTemplate($part = '###TEMPLATE###') {
$this->templateService = GeneralUtility::makeInstance(MarkerBasedTemplateService::class);
if (!empty($this->conf['templateFile'])) {
// Load template file from configuration.
if ($tool) {
$templateLocation = 'EXT:'.$this->extKey.'/Resources/Private/Templates/'.Helper::getUnqualifiedClassName(get_class($this)).'.tmpl';
$this->template = $this->templateService->getSubpart($this->cObj->fileResource($templateLocation), $part);
} else {
$this->template = $this->templateService->getSubpart($this->cObj->fileResource($this->conf['templateFile']), $part);
}
$templateFile = $this->conf['templateFile'];
} else {
if (empty($directory)) {
$templateLocation = 'EXT:'.$this->extKey.'/Resources/Private/Templates/' . Helper::getUnqualifiedClassName(get_class($this)) . '.tmpl';
} else {
$templateLocation = 'EXT:'.$this->extKey.'/Resources/Private/Templates/'. $directory . '/' . Helper::getUnqualifiedClassName(get_class($this)) . '.tmpl';
}
// Load default template file.
$this->template = $this->templateService->getSubpart($this->cObj->fileResource($templateLocation), $part);
// Load default template from extension.
$templateFile = 'EXT:'.$this->extKey.'/Resources/Private/Templates/' . Helper::getUnqualifiedClassName(get_class($this)) . '.tmpl';
}
$this->template = $this->templateService->getSubpart($this->cObj->fileResource($templateFile), $part);
}
/**

View File

@ -69,7 +69,7 @@ class AnnotationTool extends AbstractPlugin {
$this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0);
}
// Load template file.
$this->getTemplate('###TEMPLATE###', '', TRUE);
$this->getTemplate();
$annotationContainers = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$this->piVars['page']]]['annotationContainers'];
if ($annotationContainers != null && sizeof($annotationContainers)>0) {
$markerArray['###ANNOTATION_SELECT###'] = '<a class="select switchoff" id="tx-dlf-tools-annotations" title="" data-dic="annotations-on:'

View File

@ -65,7 +65,7 @@ class FulltextTool extends \Kitodo\Dlf\Common\AbstractPlugin {
$this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0);
}
// Load template file.
$this->getTemplate('###TEMPLATE###', '', TRUE);
$this->getTemplate();
$fullTextFile = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$this->piVars['page']]]['files'][$this->conf['fileGrpFulltext']];
if (!empty($fullTextFile)) {
$markerArray['###FULLTEXT_SELECT###'] = '<a class="select switchoff" id="tx-dlf-tools-fulltext" title="" data-dic="fulltext-on:'.$this->pi_getLL('fulltext-on', '', TRUE).';fulltext-off:'.$this->pi_getLL('fulltext-off', '', TRUE).'">&nbsp;</a>';

View File

@ -64,7 +64,7 @@ class ImageDownloadTool extends \Kitodo\Dlf\Common\AbstractPlugin {
$this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0);
}
// Load template file.
$this->getTemplate('###TEMPLATE###', '', TRUE);
$this->getTemplate();
// Get left or single page download.
$markerArray['###IMAGE_LEFT###'] = $this->piVars['double'] == 1 ? $this->getImage($this->piVars['page'], $this->pi_getLL('leftPage', '')) : $this->getImage($this->piVars['page'], $this->pi_getLL('singlePage', ''));
// Get right page download.

View File

@ -41,7 +41,7 @@ class ImageManipulationTool extends \Kitodo\Dlf\Common\AbstractPlugin {
$this->conf = Helper::mergeRecursiveWithOverrule($this->cObj->data['conf'], $this->conf);
}
// Load template file.
$this->getTemplate('###TEMPLATE###', '', TRUE);
$this->getTemplate();
$markerArray['###IMAGEMANIPULATION_SELECT###'] = '<span class="tx-dlf-tools-imagetools" id="tx-dlf-tools-imagetools" data-dic="imagemanipulation-on:'.$this->pi_getLL('imagemanipulation-on', '', TRUE).';imagemanipulation-off:'.$this->pi_getLL('imagemanipulation-off', '', TRUE).';reset:'.$this->pi_getLL('reset', '', TRUE).';saturation:'.$this->pi_getLL('saturation', '', TRUE).';hue:'.$this->pi_getLL('hue', '', TRUE).';contrast:'.$this->pi_getLL('contrast', '', TRUE).';brightness:'.$this->pi_getLL('brightness', '', TRUE).';invert:'.$this->pi_getLL('invert', '', TRUE).'" title="'.$this->pi_getLL('no-support', '', TRUE).'"></span>';
$content .= $this->templateService->substituteMarkerArray($this->template, $markerArray);
return $this->pi_wrapInBaseClass($content);

View File

@ -65,7 +65,7 @@ class PdfDownloadTool extends \Kitodo\Dlf\Common\AbstractPlugin {
$this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0);
}
// Load template file.
$this->getTemplate('###TEMPLATE###', '', TRUE);
$this->getTemplate();
// Get single page downloads.
$markerArray['###PAGE###'] = $this->getPageLink();
// Get work download.

View File

@ -64,7 +64,7 @@ class SearchInDocumentTool extends \Kitodo\Dlf\Common\AbstractPlugin {
}
// Load template file.
$this->getTemplate('###TEMPLATE###', '', TRUE);
$this->getTemplate();
// Configure @action URL for form.
$linkConf = array(