Markus Michalski FAQ

Accessibility Widget: Installation and Operation

Accessibility widget for Sylius - installation via Composer (Packeton), setup command, update, uninstall in the right order

Deutsche Version

Back to overview

Accessibility Widget: Installation and Operation

Live Demo: Try this and other plugins live — no installation, no risk: demo.markus-michalski.net

Installation

The repository is private and served through Packeton (https://packeton.markus-michalski.net). You receive the credentials after purchasing a license or once access has been granted.

{ "repositories": [{ "type": "composer", "url": "https://packeton.markus-michalski.net" }] }
composer require mmd/sylius-accessibility-plugin
  1. Register the bundle in config/bundles.php:

    Mmd\SyliusAccessibilityPlugin\MmdSyliusAccessibilityPlugin::class => ['all' => true],
    
  2. Import the admin routes, for example in config/routes/mmd_sylius_accessibility.yaml:

    mmd_sylius_accessibility_admin:
        resource: "@MmdSyliusAccessibilityPlugin/config/routes/admin.yaml"
    
  3. Run the setup command and publish the assets:

    bin/console mmd:accessibility:setup
    bin/console assets:install public
    

    mmd:accessibility:setup runs only this plugin's open migrations (exactly one at present, for the table mmd_sylius_accessibility_channel_settings), never those of your application or of other plugins. The command is idempotent: without a new migration nothing happens, not even after a composer update. If Sylius' own migrations are still open it aborts and tells you to run doctrine:migrations:migrate first. It also checks that the routes from step 2 are imported and prints the matching snippet otherwise - it never writes into your config/ directory itself. Run it as the same user as your other console commands; in scripts add --no-interaction. The classic doctrine:migrations:migrate still works as an alternative.

    The scripts and the stylesheet are always served from <base path>/bundles/mmdsyliusaccessibilityplugin/, never through asset() or Sylius themes. assets:install is enough, sylius:theme:assets:install is not needed.

    Content Security Policy: Allow 'self' in script-src. If the colour filter is active in a channel, the plugin also prints the filter rules as an inline <style>; style-src needs a nonce or hash for it.

As long as you do not enable a channel in the admin, the widget shows nothing (see Configuration). The admin grid, Twig hooks, the Shop API resource and the Doctrine mapping register themselves; there are no shop routes, the plugin has none. The bundle has no YAML configuration, all settings are stored in the database.

Update

composer update mmd/sylius-accessibility-plugin
bin/console mmd:accessibility:setup --no-interaction
bin/console assets:install public
bin/console cache:clear

Running the setup command again after every update is harmless: without a new migration nothing happens.

Uninstall

The order matters because Doctrine only knows the migration while the bundle is still registered:

  1. Remove your own overrides of plugin templates (for example skip_target.html.twig).

  2. While the bundle is still registered, roll the migration back:

    bin/console doctrine:migrations:execute --down 'Mmd\SyliusAccessibilityPlugin\Migrations\Version20261003140000'
    
  3. Remove the route import and the bundle entry from config/bundles.php, then:

    composer remove mmd/sylius-accessibility-plugin
    bin/console assets:install public
    

    The last call removes the copied assets again.

Alternatively you can drop the table mmd_sylius_accessibility_channel_settings by hand instead of rolling the migration back. You then also have to remove the row Mmd\SyliusAccessibilityPlugin\Migrations\Version20261003140000 from doctrine_migration_versions.