Skip to content
A custom theme for a Sonata project
CSS JavaScript HTML PHP
Branch: 2.x
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
Controller
DependencyInjection
Resources
.gitignore
LICENSE
README.md
UPGRADE-2.0.md
WearejustSonataThemeBundle.php
composer.json
package.json
webpack.config.js
yarn.lock

README.md

Sonata Theme Bundle

Latest Stable Version

Installation

Hint: Coming from 1.x? Please check out our upgrade guide

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

$ composer require wearejust/sonata-theme-bundle "^2"

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the app/AppKernel.php file of your project:

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new Wearejust\SonataThemeBundle\WearejustSonataThemeBundle(),
        );

        // ...
    }

    // ...
}

Also, enable the pixSortableBehaviorBundle by following their installation guide.

Also, add routing in your routing.yml

// routing.yml
_wearejust_sonata_theme:
    resource: "@WearejustSonataThemeBundle/Resources/config/routing.yml"

Step 3: Compile assets

The assets in this package has not een build yet. This means you have to build the assets yourself (Yarn is needed for this to work). There's webpack already configured for you, locked, loaded and ready to go. Add the following config to your own package.json file.

{
  "scripts": {
    "build-cms": "cd ./vendor/wearejust/sonata-theme-bundle && yarn && yarn run build",
  }
}

You can now run yarn run build-cms and the assets will be published to the public dir, and symlinked automatically by the Symfony Framework.

Also add the following to your config.yml.

framework:
    assets:
        packages:
            backend:
              json_manifest_path: '%kernel.root_dir%/../public/bundles/wearejustsonatatheme/build/manifest.json'

Step 4: Add extra config (optional)

It's possible to override the config we provide, you can specify an custom yml file (as Resources/config/theme.yml) the following way:

wearejust_sonata_theme:
    custom_theme: /path/to/custom/yml

As well as override our config as well as specify an extra extra_css or extra_js key in your yml.

# example.yml

extra_css:
    - /path/to/extra/css.css

extra_js:
    - /path/to/extra/js.js
    
You can’t perform that action at this time.