Skip to content

Commit

Permalink
Merge pull request #63 from dmitryd/12.x
Browse files Browse the repository at this point in the history
Fix various issues for TYPO3 v12
  • Loading branch information
SSFGizmo authored Dec 6, 2023
2 parents cc49c4d + d3edebf commit 4fa3339
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions Classes/Plugin/DirectMail.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
use TYPO3\CMS\Core\Utility\HttpUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Core\Utility\PathUtility;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;

Expand All @@ -59,7 +60,7 @@ class DirectMail
{
use DefaultJavaScriptAssetTrait;

protected ?ContentObjectRenderer $cObj = null;
public ?ContentObjectRenderer $cObj = null;

//public $prefixId;
public $prefixId = 'tx_directmail_pi1';
Expand Down Expand Up @@ -130,6 +131,16 @@ public function __construct($_ = null, TypoScriptFrontendController $frontendCon
}
}

/**
* Sets the content object render instance.
*
* @param \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $contentObjectRenderer
*/
public function setContentObjectRenderer(ContentObjectRenderer $contentObjectRenderer): void
{
$this->cObj = $contentObjectRenderer;
}

/**
* Main function, called from TypoScript
* A content object that renders "tt_content" records. See the comment to this class for TypoScript example of how to trigger it.
Expand Down Expand Up @@ -344,7 +355,7 @@ public function getHtml($str = []): string
public function getHeader(): string
{
// links...
return $this->renderHeader($this->cObj->data['header'], $this->cObj->data['header_layout']);
return $this->renderHeader($this->cObj->data['header'], (int)$this->cObj->data['header_layout']);
}

/**
Expand Down Expand Up @@ -917,7 +928,7 @@ public function addLabelsMarkers(array $markerArray): array
{
$labels = GeneralUtility::trimExplode(',', $this->labelsList);
foreach ($labels as $labelName) {
$markerArray['###' . strtoupper($labelName) . '###'] = $this->pi_getLL($labelName);
$markerArray['###' . strtoupper($labelName) . '###'] = (string)LocalizationUtility::translate($labelName, 'direct_mail');
}
return $markerArray;
}
Expand Down

0 comments on commit 4fa3339

Please sign in to comment.