定制 su-sws/stanford_media 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

su-sws/stanford_media

Composer 安装命令:

composer require su-sws/stanford_media

包简介

Stanford Media module for Drupal 8 Media management

README 文档

README

Version: 8.x

CircleCI

Maintainers: pookmish

Changelog: CHANGELOG.md

Description

The Stanford Media module is used to enhance the Drupal 8 core media management. The enhancements are listed below. This has been confirmed to work with ckeditor.

Field Formatters

In Drupal Core there is no way to select an image style on a media field. The provided field formatters pass in an image style or responsive image style into the display mode so that a desired image style is easier to display.

Embed Alter Plugins

When an media entity is being embedded into a wysiwyg, the core media implementation does not provide the user with certain customizations. The plugins (found in src/Plugin/MediaEmbedDialog) target specific media types and adds necessary customizations and pre-rendering in order to obtain the desired outcome.

Bulk Upload Page

This uses the above Dropzone Upload plugin. It allows a user to drag and drop as many allowed files as they would like. It will then provide a form for each item to allow the user to customize image alt texts, item titles, etc.

Media Duplicate Validation

To try to reduce the amount of duplicate images, the media duplicate validation will compare newly uploaded images and documents and compare them to existing items. If an item is similar enough, the user will be presented with the options to use an existing item, or continue to add the new item. Additional duplication plugins can be added when necessary.

Installation

Install this module like any other module. See Drupal Documentation If using this module on an existing site with media module previously enabled, it will over-ride existing media module configurations. Take extreme care if media entities already exist prior to this module.

When using composer to declare this as a dependency, custom modifications are needed for the dropzone library. Add or modify the root composer.json file. Below is a possible example of what to add for the dropzone library to be installed into the correct directory.

"extra": {
    "custom-installer": {
        "docroot/libraries/{$name}/": [
            "enyo/dropzone",
        ]
    }
}

When installing this module, it creates media entity types. One issue is when attempting to install the module on an install profile such as lightning or the standard install profiles. Each of these include media entity type configurations which conflict with the ones in this module. Extra steps are necessary if existing entity bundles already exist. One solution is to temporarily move all the config files in this module into the config/optional directory and then proceed with installation. This should create any missing media bundles and create the entity browsers that are included with this module. The reason for the conflicts is due to dependencies of other modules. Other modules and other config files can declare dependency on the configurations of this module. If all configurations of this module were placed in the config/optional directory, it would cause dependency issues during module/profile installation.

Configuration

  1. Add the Media Library button to the WYSIWYG as needed and check the box "Embed media".
  2. If the WYSIWYG is configured to limit allowed HTML Tags, ensure the the below is added to the list of allowed tags: <drupal-media data-entity-type data-entity-uuid data-caption data-align data-* class>
    • Although data-* would allow all data attributes and you wouldn't need to add any others, the UI form validation will throw an error without the above attributes.
    • data-caption is only required if captions are allowed. This has to be added and data-* cant be relied on due to hard coded checking of the embed form.
    • data-align is only required if the media can be aligned. Similar issue as data-align above.

Troubleshooting

If you are experiencing issues with this module try reverting the configuration files. If you are still experiencing issues try posting an issue on the GitHub issues page.

Developer

Development tools: To build and compile the CSS, Javascript, and Image assets required to make this theme great, you will need to have npm and nvm installed. Navigate to the root of the theme then.

Run:

nvm use
npm install

This project uses webpack to assemble the assets for this theme. To compile sass, javascript and push all assets in to place:

Run:

npm run publish

This script will compile all assets from /src into /dist.

Check out package.json for additional npm scripts and functionality.

Contribution / Collaboration

You are welcome to contribute functionality, bug fixes, or documentation to this module. If you would like to suggest a fix or new functionality you may add a new issue to the GitHub issue queue or you may fork this repository and submit a pull request. For more help please see GitHub's article on fork, branch, and pull requests

Releases

Steps to build a new release:

  • Checkout the latest commit from the 8.x-2.x branch.
  • Create a new branch for the release.
  • Commit any necessary changes to the release branch.
  • Make a PR to merge your release branch into master
  • Give the PR a semver-compliant label, e.g., (patch, minor, major)
  • When the PR is merged to master, a new tag will be created automatically, bumping the version by the semver label.
  • The github action is built from: semver-release-action, and further documentation is available there.

su-sws/stanford_media 适用场景与选型建议

su-sws/stanford_media 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 170.3k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2018 年 03 月 23 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 su-sws/stanford_media 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 170.3k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 12
  • 依赖项目数: 11
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2018-03-23