-
Notifications
You must be signed in to change notification settings - Fork 0
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 #77 from slub/test
Test
- Loading branch information
Showing
50 changed files
with
1,821 additions
and
1,127 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
Build/dist/* | ||
Build/node_modules/* | ||
.idea/ | ||
.Build/ | ||
Build/testing-docker/.env | ||
composer.lock | ||
public/ |
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
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
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,62 @@ | ||
<?php | ||
|
||
namespace Slub\MpdbPresentation\Controller; | ||
|
||
use \Illuminate\Support\Collection; | ||
use \Illuminate\Support\Str; | ||
use \Psr\Http\Message\ResponseInterface; | ||
use \TYPO3\CMS\Extbase\Utility\LocalizationUtility; | ||
use \Slub\MpdbPresentation\Domain\Model\Publisher; | ||
|
||
/*** | ||
* | ||
* This file is part of the "Publisher Database" Extension for TYPO3 CMS. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.txt file that was distributed with this source code. | ||
* | ||
* (c) 2021 Matthias Richter <[email protected]>, SLUB Dresden | ||
* | ||
***/ | ||
/** | ||
* PublishedItemController | ||
*/ | ||
class WelcomeController extends AbstractController | ||
{ | ||
|
||
/** | ||
* action welcome | ||
* | ||
* @return void | ||
*/ | ||
public function welcomeAction(): ResponseInterface | ||
{ | ||
$bodyText = $this->configurationManager->getContentObject()->getFieldVal('bodytext'); | ||
$and = LocalizationUtility::translate('LLL:EXT:mpdb_presentation/Resources/Private/Language/locallang:and'); | ||
|
||
$entityCount = $this->searchService-> | ||
setIndex(PublishedItemController::TABLE_INDEX_NAME)-> | ||
count(); | ||
|
||
$publishers = $this->searchService-> | ||
reset()-> | ||
setIndex(Publisher::INDEX_NAME)-> | ||
search()-> | ||
pluck('_source')-> | ||
map(function ($publisher) { return self::getPublisherName($publisher); })-> | ||
join(', ', ' ' . $and . ' '); | ||
|
||
$processedText = Str::of($bodyText)->replace('{{ publishers }}', $publishers)-> | ||
replace('{{ count }}', $entityCount); | ||
|
||
$this->view->assign('processedText', $processedText); | ||
|
||
return $this->htmlResponse(); | ||
} | ||
|
||
private static function getPublisherName(Collection $publisher): string | ||
{ | ||
return $publisher->get('name') . ' (' . $publisher->get('shorthand') . ')'; | ||
} | ||
|
||
} |
Oops, something went wrong.