ezsystems/ezplatform-xmltext-fieldtype

eZ Platform 的 XmlText 字段类型实现

安装数: 219 183

依赖项: 4

建议者: 0

安全性: 0

星标: 16

关注者: 25

分支: 29

开放问题: 4

类型:ezplatform-bundle


README

Build Status Downloads Latest release License

这是 eZ Platform 的 XmlText 字段类型。它从 eZ Publish / Platform 5.x 中提取出来,因为之后被基于 docbook 的RichText字段类型所取代。

支持限制

  • 2.x:对于 eZ Platform v3,此包仅支持将内容从 XmlText 字段类型迁移到 RichText 字段类型的目的
  • 1.x:对于 eZ Platform v1 & v2,此包支持两个用例:迁移到 RichText 以及通过平台前端*进行渲染。

* 虽然它支持通过平台管理界面进行编辑,但只能以原始 xmltext 形式在文本框中进行编辑,因此此字段类型支持的使用场景为临时升级场景,其中使用旧版管理界面,并且前端代码正在开发/迁移到 eZ Platform 栈(包括到 Symfony)。

安装

注意:此包已经包含在Legacy Bridge中。但是,如果您更愿意直接迁移内容到 eZ Platform 以充分利用它,或者您不想使用旧版但需要在纯 eZ Platform 设置中为某些旧版内容使用此字段类型,则运行以下命令:

composer require --update-with-all-dependencies "ezsystems/ezplatform-xmltext-fieldtype"

最后,通过将以下代码添加到 app/AppKernel.php 中捆绑列表中启用捆绑:new EzSystems\EzPlatformXmlTextFieldTypeBundle\EzSystemsEzPlatformXmlTextFieldTypeBundle(),

迁移内容后,您可以从 app/AppKernel.phpcomposer.json 中删除捆绑。

从 XmlText 迁移到 RichText

警告:从 1.6 版本开始,现在完全支持,但无论如何,在使用迁移工具之前始终进行备份。

此包提供工具将现有的 XmlText 字段迁移到 RichText,这是 eZ Platform 使用的丰富文本格式。该工具以 Symfony 命令 ezxmltext:convert-to-richtext 的形式提供。

它将执行以下两项操作

  • ezxmltext 字段定义转换为 ezrichtext 字段定义
  • ezxmltext 字段(内容)转换为 ezrichtext

我们建议您首先使用类似以下的内容进行测试运行:

php bin/console ezxmltext:convert-to-richtext -v --concurrency=2 --dry-run

-v 标志将输出日志到控制台,这使得跟踪正在进行的转换工作变得容易。这是一个关于单个字段的成功转换日志条目的示例

[2016-02-03 15:25:52] app.INFO: Converted ezxmltext field #745 to richtext {"original":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<section xmlns:image=\"http://ez.no/namespaces/ezpublish3/image/\" xmlns:xhtml=\"http://ez.no/namespaces/ezpublish3/xhtml/\" xmlns:custom=\"http://ez.no/namespaces/ezpublish3/custom/\"/>\n","converted":"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<section xmlns=\"http://docbook.org/ns/docbook\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:ezxhtml=\"http://ez.no/xmlns/ezpublish/docbook/xhtml\" xmlns:ezcustom=\"http://ez.no/xmlns/ezpublish/docbook/custom\" version=\"5.0-variant ezpublish-1.0\"/>\n"}

它包含在 JSON 结构中,包括 original(ezxmltext)值和写入数据库的 converted(ezrichtext)值。

准备好转换后,请删除 -v--dry-run