Skip to content

Instantly share code, notes, and snippets.

@smichaelsen
Created April 29, 2019 16:06
Show Gist options
  • Save smichaelsen/bf481c2d58f507fa33ef7752f22c67da to your computer and use it in GitHub Desktop.
Save smichaelsen/bf481c2d58f507fa33ef7752f22c67da to your computer and use it in GitHub Desktop.
Files with code examples of ~mixed~ quality
<?php
namespace MyVendor\MyExtension\Utility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
/**
* Class MediaWallUtility
*
* @package MyVendor\MyExtension\Utility
*/
class CategoryUtility
{
public function getCategoryTitleForSearchResults($content = '', $conf)
{
$newsId = $this->cObj->data['arguments'][0];
$objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
/** @var \MyVendor\MyExtension\Domain\Repository\CategoryRepository $categoryRepository */
$categoryRepository = $objectManager->get(\MyVendor\MyExtension\Domain\Repository\CategoryRepository::class);
$content = $categoryRepository->getLanguageOverlayTitle($newsId);
if ($GLOBALS['TSFE']->sys_language_uid != 0 && $content['overlaytitle']) {
return $content['overlaytitle'];
} else {
return $content['title'];
}
}
}
{namespace v=FluidTYPO3\Vhs\ViewHelpers}
<f:if condition="{item}">
<f:then>
<a href="index.php?tx_myext_pi1[item]={item.uid}" title="<f:translate key="itemLinkTitle"/>">
{item.title}
</a>
</f:then>
</f:if>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment