定制 nswdpc/silverstripe-imageselection-field 二次开发

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

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

nswdpc/silverstripe-imageselection-field

Composer 安装命令:

composer require nswdpc/silverstripe-imageselection-field

包简介

Image selection field for Silverstripe.

README 文档

README

This is a basic radio selection field, each item in the set of options can have an image associated with it.

Useful for allowing people to select an option based on an image uploaded to the file library.

Usage

$imageList = $app->getImageList();// DataList of Image records
$width = $app->getImageWidth();
$height = $app->getImageHeight();
$sampleImageField = ImageSelectionField::create(
    'SelectedImageID',
    _t(
        'myapp.CHOOSE_AN_IMAGE',
        'Choose an image'
    )
)->setDescription(
    _t(
        'myapp.CHOOSE_AN_IMAGE_HELP',
        'Choose an image that is most relevant.'
    )
)->setImageList($imageList)
->setImageDimensions($width, $height);

The module provides a stylesheet using an example flexbox layout.

Styling and templating

You will almost definitely want to use your own stylesheet, so use Requirements::block to block loading of the field.css stylesheet and then require your own stylesheet in your project.

To include your own template, override it in your project or theme in the usual Silverstripe way using the same file path, then flush cache.

More information.

Template methods

In the scope of the field:

  • {$Thumbnail($ID)} return the current image resized to the requested image width/height, pass an Image.ID value to the method
  • {$Image($ID)} return the current image, pass an Image.ID value to the method
  • {$Images} return the image list
  • {$ImageWidth} return the specified image width
  • {$ImageHeight} return the specified image height

Installation

composer require nswdpc/silverstripe-imageselection-field

License

BSD-3-Clause

Configuration

You can set the default image width/height in your project configuration

Maintainers

  • PD Web Team

Bugtracker

We welcome bug reports, pull requests and feature requests on the Github Issue tracker for this project.

Please review the code of conduct prior to opening a new issue.

Security

If you have found a security issue with this module, please email digital[@]dpc.nsw.gov.au in the first instance, detailing your findings.

Development and contribution

If you would like to make contributions to the module please ensure you raise a pull request and discuss with the module maintainers.

Please review the code of conduct prior to completing a pull request.

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2023-11-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固