zauberfisch/silverstripe-page-builder 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

zauberfisch/silverstripe-page-builder

Composer 安装命令:

composer require zauberfisch/silverstripe-page-builder

包简介

SilverStripe module to allow for modular, block based content in SilverStripe

README 文档

README

SilverStripe module to allow for modular, block based, content in SilverStripe

Maintainer Contact

Requirements

  • silverstripe/framework >=3.7
  • zauberfisch/silverstripe-serialized-dataobject >=3.0
  • zauberfisch/silverstripe-namespace-templates >=1.0

Installation

  • composer require "zauberfisch/silverstripe-page-builder"

  • Optional: install suggested packages

    • composer require "zauberfisch/silverstripe-page-builder-basic-blocks"
  • rebuild manifest (flush)

  • Unfortunately a bug in SilverStripe current breaks the HTMLEditorField file management inside a sub controller within the CMS, to work around this bug the following work around is required:

    In your project .htaccess replace RewriteRule .* framework/main.php?url=%1 [QSA] with RewriteRule .* index.php?url=%1 [QSA] and create an index.php file (you can replace the default SilverStripe file if your server supports mod_rewrite) with the following content:

      <?php
      
      if (isset($_GET['ID'])) {
          # redirect as workaround for inset File dialog in the PageBuilder
          # which is broken because ?ID=<$fileID> is mistaken for a Page ID by LeftAndMain
          # lets replace ID with FileID which is then converted back in PageBuilder
          $match = true;
          $url = $_GET['url'];
          foreach(['PageBuilder', 'EditorToolbar', 'viewfile'] as $str) {
              if (strpos($url, $str) === FALSE) {
                  $match = false;
                  break;
              }
          }
          if ($match) {
              $id = $_GET['ID'];
              $_GET['url'] = str_replace(['?ID=','&ID='],['?FileID=','&FileID='], $url);
              $_REQUEST['FileID'] = $id;
              $_GET['FileID'] = $id;
              unset($_REQUEST['ID']);
              unset($_GET['ID']);
          }
      }
      
      chdir('framework');
      require 'framework/main.php';
    

Documentation

Add the PageBuilder DB Field and FormField to any DataObject, for example Page:

class Page extends SiteTree {
    private static $db = [
        'PageBuilder' => \zauberfisch\PageBuilder\Model\DBField::class,
    ];
    
    public function getCMSFields() {
        $fields = parent::getCMSFields();
        $fields->addFieldsToTab('Root.Main', [
            new \zauberfisch\PageBuilder\Form\Field('PageBuilder', $this->fieldLabel('PageBuilder')),
        ]);
        return $fields;
    }
}

Now, in your template, you can access $PageBuilder and output the content:

<% if $PageBuilder %>
    <div class="my-content-blocks">
        $PageBuilder.Value
    </div>
<% end_if %>

See docs/example.md for example project files with some basic frontend.

However, in the bare installation this module does not provide any content types. It just provides the abstract classes and form fields.
Just like with SilverStripe DataObjects it is up to the individual developer and other modules to define the desired data types.
A good starting point with some basic block types can be found in the basic blocks module.

Documentation for creating custom blocks has not been written yet, please refer to the basic blocks module, they should serve as good examples.

Known Issues

  • When using this module with Translatable, the language selection for the TreeDropdownField in the HTMLEditorField insert link dialog does not work
  • GridFields within the dialog might not work
  • Duplicating a Record will duplicate blocks, but ContentBlocks are still linked by their ID, therefore two objects now share the same ContentElement
  • Obsolete ContentElement DataObjects are not deleted (eg if a Text Block is created, but the page is never saved)
  • The Edit Dialog is not ideal for nested content that also requires a dialog (HTMLEditor, GridField, ...)

zauberfisch/silverstripe-page-builder 适用场景与选型建议

zauberfisch/silverstripe-page-builder 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 511 次下载、GitHub Stars 达 3, 最近一次更新时间为 2016 年 11 月 15 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「block」 「content」 「silverstripe」 「blocks」 「elements」 「contentblock」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 zauberfisch/silverstripe-page-builder 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 zauberfisch/silverstripe-page-builder 我们能提供哪些服务?
定制开发 / 二次开发

基于 zauberfisch/silverstripe-page-builder 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 511
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 9
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 3
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2016-11-15