ivoaz/content-editable-bundle

此包提供了一个支持国际化的可编辑内容的twig扩展。

安装: 90

依赖者: 0

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 0

开放问题: 6

类型:symfony-bundle

dev-master / 1.0.x-dev 2016-09-30 13:25 UTC

This package is not auto-updated.

Last update: 2024-09-14 19:19:59 UTC


README

IvoazContentEditableBundle为Symfony框架提供了支持国际化的可编辑内容的twig扩展。

示例用法

<h1>{{ 'Go ahead, edit away!' | contenteditable }}</h1>

此操作将当前区域的內容保存到数据库中,并允许具有ROLE_ADMIN权限的用户使用浏览器的可编辑内容功能编辑内容。

以下是一个包含更多内容的示例

{% contenteditable "content_editable_description" %}
    <h2>HTMLElement.contentEditable</h2>
    <p>The <strong><code>HTMLElement.contentEditable</code></strong> property is used to indicate whether or not the element is editable.</p>
{% contenteditable %}

Build Status Build Status Code Coverage Scrutinizer Code Quality Total Downloads Latest Stable Version

要求

  • PHP >=5.5
  • Symfony ~2.8|~3.0
  • Doctrine ORM ~2.4
  • Twig ~1.23

安装

步骤 1: 下载包

打开命令行界面,进入您的项目目录,并执行以下命令以下载此包的最新版本

$ composer require ivoaz/content-editable-bundle

此命令要求您全局安装了Composer,请参考Composer文档中的安装章节

步骤 2: 启用包

然后,通过将其添加到项目中app/AppKernel.php文件中注册的包列表中,启用该包

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new Ivoaz\Bundle\ContentEditableBundle\IvoazContentEditableBundle(),
        );

        // ...
    }

    // ...
}

步骤 3: 更新数据库模式

内容存储在数据库中,因此您需要更新模式

$ bin/console doctrine:schema:update --force

步骤 4: 配置路由

现在使用您想要的名称前缀配置路由

# app/config/routing.yml
ivoaz_contente_ditable:
    resource: "@IvoazContentEditableBundle/Resources/config/routing.xml"
    prefix: admin/contenteditable

步骤 5: 安装资产

最后,如果您不是自己制作编辑器,则需要安装默认编辑器所需的资产

$ bin/console assets:install --symlink

文档

有关此包功能的更多详细信息,请参阅文档

许可证

此包在MIT许可证下发布