odiseoteam/sylius-blog-plugin

This plugin add blog capabilities to your Sylius project

Installs: 52

Dependents: 0

Suggesters: 0

Stars: 4

Watchers: 2

Forks: 3

Open Issues: 0

Type:sylius-plugin


README

68747470733a2f2f73796c6975732e636f6d2f6173736574732f62616467652d617070726f7665642d62792d73796c6975732e706e67

Description

This plugin add blog features the Sylius ecommerce framework. It uses the OdiseoBlogBundle Symfony bundle.

Blog admin

Blog admin

Demo

You can see this plugin in action in our Sylius Demo application.

Installation

  1. Run composer require odiseoteam/sylius-blog-plugin.

  2. Add the plugin and the OdiseoBlogBundle to the AppKernel but add it before SyliusResourceBundle. To do that you need change the registerBundles. The OdiseoBlogBundle uses FOSCKeditorBundle so you need add it to the kernel too.

public function registerBundles(): array
{
    $preResourceBundles = [
        new \Odiseo\BlogBundle\OdiseoBlogBundle(),
        new \Odiseo\SyliusBlogPlugin\OdiseoSyliusBlogPlugin(),
    ];

    $bundles = [
        ...
        new \FOS\CKEditorBundle\FOSCKEditorBundle(),
    ];

    return array_merge($preResourceBundles, parent::registerBundles(), $bundles);
}
  1. Import the configurations on your config.yml:
    - { resource: "@OdiseoSyliusBlogPlugin/Resources/config/config.yml" }
  1. Add the routes:
odiseo_sylius_blog_admin:
    resource: "@OdiseoSyliusBlogPlugin/Resources/config/routing/admin.yml"
    prefix: /admin
    
odiseo_sylius_blog_shop:
    resource: "@OdiseoSyliusBlogPlugin/Resources/config/routing/shop.yml"
    prefix: /{_locale}/blog
  1. Because this plugin uses FOSCKeditorBundle you need to exacute the following commands according to the bundle installation:
php bin/console ckeditor:install
php bin/console assets:install web
  1. Finish the installation updatating the database schema and installing assets:
php bin/console doctrine:schema:update --force
php bin/console sylius:theme:assets:install

Usage

For the administration you will have the Blog menu. And for the frontend you can go to the /{locale}/blog to see the blog articles. Feel free to modify the plugin templates like you want.

Partial routes

To render a list of latest articles you can do something like this:

{{ render(url('odiseo_sylius_blog_shop_partial_article_index_latest', {'count': 4, 'template': '@OdiseoSyliusBlogPlugin/Shop/Article/_latest.html.twig'})) }}

And to render a list of categories:

{{ render(url('odiseo_sylius_blog_shop_partial_article_category_index', {'template': '@OdiseoSyliusBlogPlugin/Shop/ArticleCategory/_verticalMenu.html.twig'})) }}

Test the plugin

You can follow the instructions to test this plugins in the proper documentation page: Test the plugin.

Credits

This plugin is maintained by Odiseo. Want us to help you with this plugin or any Sylius project? Contact us on team@odiseo.com.ar.