-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from pagemachine/typo3v9-extbase-translations
Support translated Extbase previews with TYPO3v9+
- Loading branch information
Showing
12 changed files
with
227 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
Tests/Functional/Fixtures/Extensions/extbase_l10n_test/Classes/Domain/Model/Content.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
declare(strict_types = 1); | ||
|
||
namespace Pagemachine\SearchableExtbaseL10nTest\Domain\Model; | ||
|
||
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; | ||
|
||
final class Content extends AbstractEntity | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $header; | ||
|
||
public function getHeader(): string | ||
{ | ||
return $this->header; | ||
} | ||
|
||
public function setHeader(string $header): void | ||
{ | ||
$this->header = $header; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...nal/Fixtures/Extensions/extbase_l10n_test/Classes/Domain/Repository/ContentRepository.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
declare(strict_types = 1); | ||
|
||
namespace Pagemachine\SearchableExtbaseL10nTest\Domain\Repository; | ||
|
||
use TYPO3\CMS\Extbase\Persistence\Repository; | ||
|
||
final class ContentRepository extends Repository | ||
{ | ||
} |
30 changes: 30 additions & 0 deletions
30
...nctional/Fixtures/Extensions/extbase_l10n_test/Classes/Preview/ContentPreviewRenderer.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
declare(strict_types = 1); | ||
|
||
namespace Pagemachine\SearchableExtbaseL10nTest\Preview; | ||
|
||
use PAGEmachine\Searchable\Preview\PreviewRendererInterface; | ||
use Pagemachine\SearchableExtbaseL10nTest\Domain\Repository\ContentRepository; | ||
use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
use TYPO3\CMS\Extbase\Object\ObjectManager; | ||
|
||
final class ContentPreviewRenderer implements PreviewRendererInterface | ||
{ | ||
/** | ||
* @param array $record | ||
* @return string | ||
*/ | ||
public function render($record) | ||
{ | ||
$objectManager = GeneralUtility::makeInstance(ObjectManager::class); | ||
$repository = $objectManager->get(ContentRepository::class); | ||
$content = $repository->findByIdentifier($record['uid']); | ||
$preview = sprintf( | ||
'Preview: %s [%d]', | ||
$content->getHeader(), | ||
$content->_getProperty('_localizedUid') | ||
); | ||
|
||
return $preview; | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
...ional/Fixtures/Extensions/extbase_l10n_test/Configuration/Extbase/Persistence/Classes.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
declare(strict_types = 1); | ||
|
||
return [ | ||
\Pagemachine\SearchableExtbaseL10nTest\Domain\Model\Content::class => [ | ||
'tableName' => 'tt_content', | ||
], | ||
]; |
8 changes: 8 additions & 0 deletions
8
Tests/Functional/Fixtures/Extensions/extbase_l10n_test/composer.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"name": "pagemachine/searchable-extbase-l10n-test", | ||
"autoload": { | ||
"psr-4": { | ||
"Pagemachine\\SearchableExtbaseL10nTest\\": "Classes/" | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Tests/Functional/Fixtures/Extensions/extbase_l10n_test/ext_emconf.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
$EM_CONF[$_EXTKEY] = [ | ||
'title' => 'Extbase Localization Test', | ||
'version' => '0.0.0', | ||
'constraints' => [ | ||
'depends' => [ | ||
'typo3' => '0.0.0', | ||
], | ||
], | ||
]; |
11 changes: 11 additions & 0 deletions
11
Tests/Functional/Fixtures/Extensions/extbase_l10n_test/ext_typoscript_setup.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
config.tx_extbase { | ||
persistence { | ||
classes { | ||
Pagemachine\SearchableExtbaseL10nTest\Domain\Model\Content { | ||
mapping { | ||
tableName = tt_content | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters