Skip to content

Commit

Permalink
Fix amount index widget and format code
Browse files Browse the repository at this point in the history
  • Loading branch information
lochmueller committed Jul 20, 2021
1 parent cbcb451 commit b8c2b65
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Classes/ViewHelpers/IndicesByObjectViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use TYPO3\CMS\Extbase\Persistence\QueryInterface;

/**
* Indices by object
* Indices by object.
*
* == Examples ==
*
Expand Down Expand Up @@ -59,7 +59,7 @@ public function render()
}
}

if ($config === null) {
if (null === $config) {
return [];
}

Expand All @@ -71,7 +71,7 @@ public function render()
$fakeIndex,
$this->arguments['future'],
$this->arguments['past'],
(int) $this->arguments['limit'],
(int)$this->arguments['limit'],
$this->arguments['sort'],
false
);
Expand Down
2 changes: 1 addition & 1 deletion Classes/Widgets/DataProvider/IndexAmountDataProvider.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace HDNET\Calendarize\Widgets\DataProvider;
Expand All @@ -22,7 +23,6 @@ public function injectIndexRepository(IndexRepository $indexRepository)

public function getNumber(): int
{
return 100;
return $this->indexRepository->findAll()->count();
}
}
5 changes: 4 additions & 1 deletion Classes/Widgets/DataProvider/NextEventsDataProvider.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace HDNET\Calendarize\Widgets\DataProvider;
Expand Down Expand Up @@ -28,7 +29,8 @@ public function getItems(): array
{
$options = new OptionRequest();
// @todo create new backend functions
$indices = array_slice($this->indexRepository->findAllForBackend($options)->toArray(), 0, 15);
$indices = \array_slice($this->indexRepository->findAllForBackend($options)->toArray(), 0, 15);

return array_map(function (Index $index) {
try {
/** @var StandaloneView $standaloneView */
Expand All @@ -37,6 +39,7 @@ public function getItems(): array
$standaloneView->setPartialRootPaths(['EXT:calendarize/Resources/Private/Partials/', 'EXT:calendarize_premium/Resources/Private/Partials/']);

$titlePartial = $index->getConfiguration()['partialIdentifier'] . '/Title';

return $standaloneView->renderPartial($titlePartial, null, ['index' => $index]);
} catch (\Exception $exception) {
return $exception->getMessage();
Expand Down

0 comments on commit b8c2b65

Please sign in to comment.