Skip to content

Commit

Permalink
Merge pull request #491 from oat-sa/fix/ADF-1842/enable-section-filte…
Browse files Browse the repository at this point in the history
…r-on-installation

fix: add missing section filters on installation
  • Loading branch information
gabrielfs7 authored Dec 4, 2024
2 parents f351c63 + fe1e62e commit bd94583
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
2 changes: 2 additions & 0 deletions manifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
use oat\taoTests\scripts\install\RegisterTestProviderService;
use oat\taoTests\scripts\install\SetupEventListeners;
use oat\taoTests\scripts\install\SetupProvider;
use oat\taoTests\scripts\install\SetupSectionVisibilityFilters;
use oat\taoTests\scripts\update\Updater;

$extpath = __DIR__ . DIRECTORY_SEPARATOR;
Expand All @@ -66,6 +67,7 @@
RegisterTestPreviewerRegistryService::class,
SetupProvider::class,
SetupEventListeners::class,
SetupSectionVisibilityFilters::class
],
],
'update' => Updater::class,
Expand Down
45 changes: 45 additions & 0 deletions scripts/install/SetupSectionVisibilityFilters.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

/**
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; under version 2
* of the License (non-upgradable).
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Copyright (c) 2024 (original work) Open Assessment Technologies SA.
*/

declare(strict_types=1);

namespace oat\taoTests\scripts\install;

use oat\oatbox\extension\InstallAction;
use oat\tao\model\menu\SectionVisibilityFilter;

class SetupSectionVisibilityFilters extends InstallAction
{
public function __invoke($params)
{
/** @var SectionVisibilityFilter $sectionVisibilityFilter */
$sectionVisibilityFilter = $this->getServiceManager()->get(SectionVisibilityFilter::SERVICE_ID);
$sectionVisibilityFilter->showSectionByFeatureFlag(
$sectionVisibilityFilter->createSectionPath(
[
'manage_tests',
'test-translate'
]
),
'FEATURE_FLAG_TRANSLATION_ENABLED'
);
$this->getServiceManager()->register(SectionVisibilityFilter::SERVICE_ID, $sectionVisibilityFilter);
}
}

0 comments on commit bd94583

Please sign in to comment.