Hint: Coming from 1.x? Please check out our upgrade guide
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.
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"
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'
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