sherlockode/sylius-advanced-content-plugin

Sylius插件,用于SherlockodeAdvancedContentBundle

v0.3.1 2023-11-14 13:56 UTC

This package is auto-updated.

Last update: 2024-09-11 11:28:53 UTC


README

Support

image

目录

概述

此插件可在您的Sylius网站上启用Sherlockode的AdvancedContentBundle。

它为最终用户提供高级CMS功能。用户可以通过我们直观的界面快速轻松地构建他们的网站页面。包括文本块、标题、图片、图片轮播、视频播放器等标准元素。可以通过行和列元素按需塑造响应式布局。草稿将自动保存,并可以轻松回滚到上一个版本。只需几行代码即可简单添加自定义元素。

安装

使用composer安装插件

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

配置

从捆绑包导入路由配置和Sylius配置

# 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'

关于资产,应执行与独立AdvancedContentBundle相同的设置。

使用以下内容更新您的package.json

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

在您的资产中的admin JS入口文件中,添加捆绑包的资源

// ./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';

如果您使用Webpack,您可以在您的admin配置中添加以下行

// ./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')
        }
    }
});

使用

该插件在管理员菜单中添加了新的内容部分。
它包括页面网格、内容网格和工具页面的链接。

您可以在Advanced Content Bundle的文档中检查我们的文档,了解更多关于如何使用插件的信息

自定义页面预览

默认情况下,用于显示页面预览的布局位于@SherlockodeSyliusAdvancedContentPlugin/Preview/preview.html.twig。您可以通过像任何第三方捆绑包中的模板一样覆盖它,或通过替换sherlockode_sylius_acb.preview.view_handler服务来管理根据页面类型的不同布局

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

并且通过自己定义服务

<?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';
    }
}

演示Sylius商店

我们创建了一个带有插件一些有用用例的演示应用!访问sylius-demo.sherlockode.fr查看。管理员可以通过sylius-demo.sherlockode.fr/admin/login链接访问。
我们在演示中使用的插件

为开发者提供的额外资源

要了解更多关于我们的贡献流程和其他信息,我们鼓励您使用以下资源

许可证

此插件的源代码完全免费,并按照MIT许可证的条款发布。

联系方式

如果您想联系我们,最佳方式是在我们的网站上填写表格或发送电子邮件至contact@sherlockode.fr,附带您的问题(s)。我们保证我们会尽快回答!