Skip to content

Commit edf1b62

Browse files
committed
+ init files
1 parent 1f147c8 commit edf1b62

27 files changed

+912
-1
lines changed

.github/workflows/ci.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Accessibility Bundle code review
2+
3+
on:
4+
push:
5+
branches: [ "main", "develop" ]
6+
pull_request:
7+
branches: [ "main", "develop" ]
8+
9+
jobs:
10+
review:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- name: Setup PHP, with composer and extensions
16+
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
17+
with:
18+
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, mysql, zip
19+
20+
- name: Cache Composer packages
21+
id: composer-cache
22+
uses: actions/cache@v3
23+
with:
24+
path: vendor
25+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
26+
restore-keys: |
27+
${{ runner.os }}-php-
28+
29+
- name: Install dependencies
30+
run: composer install --no-interaction --no-progress
31+
32+
- name: Check for vulnerabilities
33+
uses: symfonycorp/security-checker-action@v4
34+
35+
- name: Run Easy Coding Standard
36+
run: vendor/bin/ecs check src
37+
38+
- name: Run PHP Stan
39+
run: |
40+
composer require phpstan/phpstan
41+
composer require phpstan/extension-installer
42+
composer require phpstan/phpstan-symfony
43+
./vendor/bin/phpstan analyse src --memory-limit 1G

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
vendor
2+
var
3+
composer.lock

README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changelog
2+
3+
## 1.0.0 (07/07/2025)
4+
5+
+ First release

composer.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "pixelopen/sulu-accessibilitybundle",
3+
"description": "A Sulu Bundle for manage accessibility for a website",
4+
"type": "bundle",
5+
"require": {
6+
"php": "^8.2",
7+
"sulu/sulu": "^2.6",
8+
"symfony/dependency-injection": "^6.0",
9+
"symfony/http-kernel": "^6.0",
10+
"sulu/web-twig": "^2.5"
11+
},
12+
"require-dev": {
13+
"dantleech/phpcr-migrations-bundle": "^1.3",
14+
"jackalope/jackalope-doctrine-dbal": "^1.3.2",
15+
"phpstan/extension-installer": "^1.2",
16+
"phpstan/phpstan": "^1.9",
17+
"phpstan/phpstan-symfony": "^1.2",
18+
"symplify/easy-coding-standard": "^11.1"
19+
},
20+
"license": "MIT",
21+
"autoload": {
22+
"psr-4": {
23+
"Pixel\\AccessibilityBundle\\": "src"
24+
}
25+
},
26+
"config": {
27+
"sort-packages": true,
28+
"allow-plugins": {
29+
"phpstan/extension-installer": true,
30+
"php-http/discovery": false
31+
}
32+
},
33+
"scripts": {
34+
"analyse": "composer-require-checker"
35+
}
36+
}

ecs.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer;
6+
use Symplify\EasyCodingStandard\Config\ECSConfig;
7+
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;
8+
9+
return static function (ECSConfig $ecsConfig): void {
10+
$ecsConfig->paths([__DIR__ . '/src']);
11+
$ecsConfig->ruleWithConfiguration(ArraySyntaxFixer::class, [
12+
'syntax' => 'short',
13+
]);
14+
15+
$ecsConfig->sets([
16+
// run and fix, one by one
17+
SetList::SPACES,
18+
SetList::ARRAY,
19+
SetList::DOCBLOCK,
20+
SetList::PSR_12,
21+
]);
22+
};

phpstan.neon

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
parameters:
2+
level: 6
3+
4+
paths:
5+
- src

readme.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<h1 align="center">
2+
Accessiblity for Sulu
3+
</h1>
4+
<div align="center">
5+
A Sulu Bundle for manage accessibility for a website
6+
7+
[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%208.2-green)](https://php.net/)
8+
[![Minimum Sulu Version](https://img.shields.io/badge/sulu-%3E%3D%202.6-green)](https://symfony.com)
9+
[![GitHub release](https://img.shields.io/github/v/release/Pixel-Open/sulu-plausiblebundle)](https://github.com/Pixel-Open/sulu-plausiblebundle/releases)
10+
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Pixel-Open_sulu-plausiblebundle&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=Pixel-Open_sulu-plausiblebundle)
11+
12+
</div>
13+
14+
## 🚀 Installation
15+
16+
1. Install the bundle with composer
17+
```bash
18+
composer require pixelopen/sulu-accessibilitybundle
19+
```
20+
21+
## 🏳️ Translations
22+
23+
The bundle includes full translation support:
24+
25+
### Supported Languages
26+
- **English** (`admin.en.json`)
27+
- **French** (`admin.fr.json`)
28+
29+
### Adding New Languages
30+
To add support for additional languages, create new translation files:
31+
```
32+
src/Resources/translations/admin.{locale}.json
33+
```

src/AccessibilityBundle.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Pixel\AccessibilityBundle;
4+
5+
use Sulu\Bundle\PersistenceBundle\PersistenceBundleTrait;
6+
use Symfony\Component\HttpKernel\Bundle\Bundle;
7+
8+
class AccessibilityBundle extends Bundle
9+
{
10+
use PersistenceBundleTrait;
11+
}

src/Admin/SettingAdmin.php

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Pixel\AccessibilityBundle\Admin;
6+
7+
use Pixel\AccessibilityBundle\Entity\Setting;
8+
use Sulu\Bundle\AdminBundle\Admin\Admin;
9+
use Sulu\Bundle\AdminBundle\Admin\Navigation\NavigationItem;
10+
use Sulu\Bundle\AdminBundle\Admin\Navigation\NavigationItemCollection;
11+
use Sulu\Bundle\AdminBundle\Admin\View\ToolbarAction;
12+
use Sulu\Bundle\AdminBundle\Admin\View\ViewBuilderFactory;
13+
use Sulu\Bundle\AdminBundle\Admin\View\ViewCollection;
14+
use Sulu\Component\Security\Authorization\PermissionTypes;
15+
use Sulu\Component\Security\Authorization\SecurityCheckerInterface;
16+
17+
class SettingAdmin extends Admin
18+
{
19+
public const TAB_VIEW = "accessibility.settings";
20+
public const FORM_VIEW = "accessibility.settings.form";
21+
22+
private ViewBuilderFactory $viewBuilderFactory;
23+
private SecurityCheckerInterface $securityChecker;
24+
25+
public function __construct(
26+
ViewBuilderFactory $viewBuilderFactory,
27+
SecurityCheckerInterface $securityChecker
28+
) {
29+
$this->viewBuilderFactory = $viewBuilderFactory;
30+
$this->securityChecker = $securityChecker;
31+
}
32+
33+
public function configureNavigationItems(NavigationItemCollection $navigationItemCollection): void
34+
{
35+
if ($this->securityChecker->hasPermission(Setting::SECURITY_CONTEXT, PermissionTypes::EDIT)) {
36+
$navigationItem = new NavigationItem("accessibility.settings");
37+
$navigationItem->setPosition(5);
38+
$navigationItem->setView(static::TAB_VIEW);
39+
$navigationItemCollection->get(Admin::SETTINGS_NAVIGATION_ITEM)->addChild($navigationItem);
40+
}
41+
}
42+
43+
public function configureViews(ViewCollection $viewCollection): void
44+
{
45+
if ($this->securityChecker->hasPermission(Setting::SECURITY_CONTEXT, PermissionTypes::EDIT)) {
46+
$viewCollection->add(
47+
$this->viewBuilderFactory->createResourceTabViewBuilder(static::TAB_VIEW, "/accessibility-settings/:id")
48+
->setResourceKey(Setting::RESOURCE_KEY)
49+
->setAttributeDefault("id", "-")
50+
);
51+
52+
$viewCollection->add(
53+
$this->viewBuilderFactory->createFormViewBuilder(static::FORM_VIEW, "/details")
54+
->setResourceKey(Setting::RESOURCE_KEY)
55+
->setFormKey(Setting::FORM_KEY)
56+
->setTabTitle("sulu_admin.details")
57+
->addToolbarActions([new ToolbarAction("sulu_admin.save")])
58+
->setParent(static::TAB_VIEW)
59+
);
60+
}
61+
}
62+
63+
public function getSecurityContexts()
64+
{
65+
return [
66+
self::SULU_ADMIN_SECURITY_SYSTEM => [
67+
'Setting' => [
68+
Setting::SECURITY_CONTEXT => [
69+
PermissionTypes::VIEW,
70+
PermissionTypes::EDIT,
71+
],
72+
],
73+
],
74+
];
75+
}
76+
}

0 commit comments

Comments
 (0)