Skip to content

Commit

Permalink
fix(chore): resolve problem of typo and implement missing field into tab
Browse files Browse the repository at this point in the history
  • Loading branch information
jorisdugue committed Jan 30, 2024
1 parent 7baa46f commit c21221c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 22 deletions.
15 changes: 8 additions & 7 deletions Core/H5PIntegration.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ public function getGenericH5PIntegrationSettings()
'l10n' => ['H5P' => $this->core->getLocalization()],
'hubIsEnabled' => $hubIsEnabled,
'siteUrl' => $this->requestStack->getMainRequest()->getUri(),
'librairyConfig' => $this->core->h5pF->getLibraryConfig()
'libraryConfig' => $this->core->h5pF->getLibraryConfig(),
'reportingIsEnabled' => $this->core->h5pF->getOption('enable_lrs_content_type', false) === 1
];
if (is_object($user)) {
$settings['user'] = [
Expand All @@ -126,10 +127,10 @@ public function getGenericH5PIntegrationSettings()
/**
* Get a list with prepared asset links that is used when JS loads components.
*
* @param null|array $keys [$keys] Optional keys, first for JS second for CSS.
* @param array|null $keys [$keys] Optional keys, first for JS second for CSS.
* @return array
*/
public function getCoreAssets($keys = null): array
public function getCoreAssets(?array $keys = null): array
{
if (empty($keys)) {
$keys = ['scripts', 'styles'];
Expand All @@ -141,11 +142,11 @@ public function getCoreAssets($keys = null): array
];
// Add all core scripts
foreach (\H5PCore::$scripts as $script) {
$assets[$keys[0]][] = "{$this->options->getH5PAssetPath()}/h5p-core/{$script}";
$assets[$keys[0]][] = "{$this->options->getH5PAssetPath()}/h5p-core/$script";
}
// and styles
foreach (\H5PCore::$styles as $style) {
$assets[$keys[1]][] = "{$this->options->getH5PAssetPath()}/h5p-core/{$style}";
$assets[$keys[1]][] = "{$this->options->getH5PAssetPath()}/h5p-core/$style";
}
return $assets;
}
Expand Down Expand Up @@ -284,7 +285,7 @@ private function getAssets($collection, $prefix, $exceptions = null): array
if ($exceptions && in_array($item, $exceptions)) {
continue;
}
$assets[] = "{$prefix}{$item}{$cacheBuster}";
$assets[] = "$prefix$item$cacheBuster";
}
return $assets;
}
Expand All @@ -297,7 +298,7 @@ private function getAssets($collection, $prefix, $exceptions = null): array
public function getCacheBuster(): string
{
$cache_buster = \H5PCore::$coreApi['majorVersion'] . '.' . \H5PCore::$coreApi['minorVersion'];
return $cache_buster ? "?={$cache_buster}" : '';
return $cache_buster ? "?=$cache_buster" : '';
}

/**
Expand Down
17 changes: 8 additions & 9 deletions Service/ResultService.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,14 @@ public function handleRequestFinished(Request $request, $userId)
*/
public function removeData($contentId, $dataType, $user, $subContentId)
{
$ContentUserData = $this->em->getRepository('Studit\H5PBundle\Entity\ContentUserData')
->findBy(
[
'subContentId' => $subContentId,
'mainContent' => $contentId,
'dataId' => $dataType,
'user' => $user->getId()
]
);
$ContentUserData = $this->em->getRepository('Studit\H5PBundle\Entity\ContentUserData')->findBy(
[
'subContentId' => $subContentId,
'mainContent' => $contentId,
'dataId' => $dataType,
'user' => $user->getId()
]
);
if (count($ContentUserData) > 0) {
foreach ($ContentUserData as $content) {
$this->em->remove($content);
Expand Down
10 changes: 4 additions & 6 deletions Twig/H5PExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@ public function __construct(H5PIntegration $h5pIntegration)
$this->h5pIntegration = $h5pIntegration;
}

public function getFilters()
public function getFilters(): array
{
return array(
new TwigFilter('h5pCacheBuster', array($this, 'getH5PCacheBuster')),
);
return [new TwigFilter('h5pCacheBuster', [$this, 'getH5PCacheBuster']),];
}

public function getH5PCacheBuster($script)
public function getH5PCacheBuster($script): string
{
return $script . $this->h5pIntegration->getCacheBuster();
}
Expand All @@ -38,7 +36,7 @@ public function getH5PCacheBuster($script)
*
* @return string The extension name
*/
public function getName()
public function getName(): string
{
return 'h5p_extension';
}
Expand Down

0 comments on commit c21221c

Please sign in to comment.