承接 unifik/media-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

unifik/media-bundle

Composer 安装命令:

composer require unifik/media-bundle

包简介

The media bundle of the symfony-unifik distribution

README 文档

README

Installation

Using composer file :

"require": {
    //...,
    "unifik/media-bundle": "dev-master"
},

Add the following line to AppKernel.php :

new Unifik\MediaBundle\UnifikMediaBundle(),

In app/config/routing.yml add the following:

unifik_media_backend:
    resource: "@UnifikMediaBundle/Resources/config/routing_backend.yml"
    prefix:   /admin/media

To activate the media manager with CKEditor once the bundle is loaded, you must register the plugin in the ckeditor config (app/config/config.yml):

external_plugins:
    unifikmediamanager:
        path: bundles/unifikmedia/backend/js/ckeditor/plugin/unifikmediamanager

You must also add the 'Insert_media' button in one toolbar. An example of config:

trsteel_ckeditor:
  toolbar_groups:
      [...]
      insert: ['Insert_media', 'Image', 'Flash', 'Table', 'HorizontalRule']
      [...]

To get the proper media select field in your form, your need to add those lines in your form theme:

{% block media_select_widget %}
    {% include 'UnifikMediaBundle:Backend/Form:fields.html.twig' with {'widget_attributes': block('widget_attributes')} %}
{% endblock %}

This bundle use FOSRoutingBundle. So you need to include the following js files:

{% javascripts
    'bundles/fosjsrouting/js/router.js'
    'js/fos_js_routes.js'
%}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}

And run this command: app/console fos:js-routing:dump

Include the dynamic_loader.js file required to add the Media Bundle CKEditor Plugin:

{% javascripts
    '@UnifikMediaBundle/Resources/public/backend/js/dynamic_loader.js'
%}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}

Include the liip imagine routing in your config.yml file:

_liip_imagine:
    resource: "@LiipImagineBundle/Resources/config/routing.xml"

Bundle requirements

  • unifik/doctrine-behaviors-bundle
  • liip/imagine-bundle
  • friendsofsymfony/jsrouting-bundle

Add Media field

To link media with entity, add the manyToOne relation as follow:

manyToOne:
  myMedia:
    targetEntity: Unifik\MediaBundle\Entity\Media

To generate de media field, add this in your form type: (default type is image)

->add('image2', 'media_select')

To choose an other media type: (available types are: image, video, embedvideo and document)

->add('image2', 'media_select', array('type' => 'image'))

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 8
  • Forks: 3
  • 开发语言: JavaScript

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-10-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固