Giter Club home page Giter Club logo

syliusadvancedcontentplugin's Introduction

Sylius AdvancedContent plugin


Support

image

Table of Content


Overview


This plugin enables Sherlockode's AdvancedContentBundle on your Sylius website.

It provides advanced CMS features for end user contribution. Users can build their website pages quickly and effortlessly thanks to our intuitive interface. Several standard elements are included, such as text block, heading, image, image carousel, video player, ... Responsive layouts can be shaped as needed with row and column elements. Drafts are saved automatically and it's easy to rollback to a previous version. Custom elements can be added simply with a few lines of code.

Installation


Install the plugin with composer:

$ composer require sherlockode/sylius-advanced-content-plugin

Configuration


Import the routing configuration and Sylius configuration from the bundle

# config/sylius_acb.yaml
imports:
    - { resource: "@SherlockodeSyliusAdvancedContentPlugin/Resources/config/config.yaml" }
# config/routes/sylius_acb.yaml
sherlockode_advanced_content_bundle:
    resource: "@SherlockodeAdvancedContentBundle/Resources/config/routing/base.xml"
    prefix: '/%sylius_admin.path_name%/acb'

sherlockode_advanced_content:
    resource: "@SherlockodeSyliusAdvancedContentPlugin/Resources/config/admin_routing.yaml"
    prefix: '/%sylius_admin.path_name%/acb'

sherlockode_advanced_content_shop:
    resource: "@SherlockodeSyliusAdvancedContentPlugin/Resources/config/shop_routing.yaml"
    prefix: '/{_locale}/acb'

Regarding the assets, the same setup as for the standalone AdvancedContentBundle should be done.

Update your package.json with the following:

{
  "dependencies": {
    "@fortawesome/fontawesome-free": "^6.1.2",
    "jquery": "^3.5.0",
    "jquery-ui": "1.12.1"
  }
}

In the admin JS entry file from your assets, add the resources from the bundle:

// ./assets/admin/entry.js
//...
import '../../vendor/sherlockode/advanced-content-bundle/Resources/public/css/index.scss';
import '../../vendor/sherlockode/advanced-content-bundle/Resources/js/index.js';
import '../../vendor/sherlockode/sylius-advanced-content-plugin/src/Resources/public/css/index.scss';

import '@fortawesome/fontawesome-free/css/fontawesome.css';
import '@fortawesome/fontawesome-free/css/solid.css';

If you are using Webpack, you can add the following lines to your admin configuration:

// ./webpack.config.js
//...
Encore.addLoader({
    resolve: {
        alias: {
            './acb-notification.js$': path.resolve(__dirname, 'vendor/sherlockode/sylius-advanced-content-plugin/src/Resources/js/AdvancedContentBundle/acb-notification.js')
        }
    }
});

Create migration for your database with:

php bin/console make:migration

Publish the assets to finish the installation

php bin/console assets:install public

Usage


The plugin adds a new Content section in the admin menu.
It includes links to the Page grid, to the Content grid and to the Tools page.

You can checkout our documentation on the Advanced Content Bundle to learn more on how to use the plugin:

Customizing page preview

By default, the layout used to show the page previews is located at @SherlockodeSyliusAdvancedContentPlugin/Preview/preview.html.twig. You can customize this template by overriding it like any template in a third party bundle, or by replacing the sherlockode_sylius_acb.preview.view_handler service to manage different layouts depending on the page type:

services:
    sherlockode_sylius_acb.preview.view_handler:
        class: App\Acb\ViewHandler

And defining the service by yourself:

<?php

namespace App\Acb;

use Sherlockode\AdvancedContentBundle\Model\PageInterface;
use Sherlockode\AdvancedContentBundle\Model\ScopeInterface;
use Sherlockode\SyliusAdvancedContentPlugin\Preview\ViewHandlerInterface;

class ViewHandler implements ViewHandlerInterface
{
    /**
     * @param PageInterface  $page
     * @param ScopeInterface $scope
     *
     * @return string|null
     */
    public function getViewTemplate(PageInterface $page, ScopeInterface $scope): ?string
    {
        if ('homepage' === $page->getPageIdentifier()) {
            return '@SyliusShop/Acb/homepage.html.twig';
        }
        
        return '@SyliusShop/Acb/page.html.twig';
    }
}

Access to custom page

url('sherlockode_sylius_acb_shop_page_view', {'pageIdentifier': slugOfMyCustomPage})

Demo Sylius Shop


We created a demo app with some useful use-cases of plugins! Visit sylius-demo.sherlockode.fr to take a look at it. The admin can be accessed under sylius-demo.sherlockode.fr/admin/login link.
Plugins that we have used in the demo:

Plugin name GitHub Sylius' Store
Advance Content Bundle (ACB) https://github.com/sherlockode/SyliusAdvancedContentPlugin -
Mondial Relay https://github.com/sherlockode/SyliusMondialRelayPlugin -
Checkout Plugin https://github.com/sherlockode/SyliusCheckoutPlugin -
FAQ https://github.com/sherlockode/SyliusFAQPlugin -

Additional resources for developers


To learn more about our contribution workflow and more, we encourage you to use the following resources:

License


This plugin's source code is completely free and released under the terms of the MIT license.

Contact


If you want to contact us, the best way is to fill the form on our website or send us an e-mail to [email protected] with your question(s). We guarantee that we answer as soon as we can!

syliusadvancedcontentplugin's People

Contributors

sophie-mulard avatar juchi avatar vowow avatar etrange02 avatar neilpeyssard avatar brownsim avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.