Skip to content

monsieurbiz/SyliusScriptsPlugin

Repository files navigation

Monsieur Biz logo      Sylius logo
Monsieur Biz is a Sylius Extension Artisan partner

Scripts Settings for Sylius

Scripts Plugin license Tests Status Recipe Status Security Status

This plugin lets you add JS scripts from the admin panel. You can add scripts to the header or the footer of your website.
For example, add Google Analytics, Facebook Pixel, or any other tracking script.

Compatibility

Sylius Version PHP Version
1.11 8.0 - 8.1
1.12 8.1 - 8.2
1.13 8.1 - 8.2

Installation

If you want to use our recipes, you can configure your composer.json by running:

composer config --no-plugins --json extra.symfony.endpoint '["https://api.github.com/repos/monsieurbiz/symfony-recipes/contents/index.json?ref=flex/master","flex://defaults"]'
composer require monsieurbiz/sylius-scripts-plugin

Create the config file in config/packages/monsieurbiz_sylius_scripts_plugin.yaml:

imports:
    resource: '@MonsieurBizSyliusScriptsPlugin/Resources/config/config.yaml'

Configuration

Go to the admin panel, then Settings > Scripts and add your scripts:

Screenshot of the scripts form in admin panel

And that's it! Your scripts will be added:

Screenshot of the shop example

How to

Change the default settings values for your project

Open the config/packages/monsieurbiz_sylius_scripts_plugin.yaml file and change the default values. For example:

monsieurbiz_sylius_settings:
    plugins:
        monsieurbiz_scripts.scripts:
            default_values:
                before_head_end: |
                    <script type="text/javascript">console.log('My script');</script>