承接 pr3set-llc/silverstripe-bootstrap-forms 相关项目开发

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

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

pr3set-llc/silverstripe-bootstrap-forms

Composer 安装命令:

composer require pr3set-llc/silverstripe-bootstrap-forms

包简介

An extension to add CSS classes to Silverstripe forms to play nicer with Twitter Bootstrap

README 文档

README

An extension to add CSS classes to Silverstripe forms to "play nicer" with Twitter Bootstrap, mostly by adding the form-control bootstrap CSS classes to form elements (input, dropdown, submit etc).

This is designed to be a plug-and-play extension, without requiring you to change your existing forms on your website. This includes all forms such as login forms, password reset forms, as well as any other form you have created.

It extends FormField to try provide a transparent "manipulation" of the rendered form fields, adding some bootstrap CSS to the rendered fields. It does not produce bootstrap-specific html for your forms.

FormField unfortunately only has a $this->extend('onBeforeRender', $this); in Field that allows manipulation of the field itself, and not the parent field_holder. This allows only a very limited amount of flexibility, and prevents an extension from changing the field_holder.

Form submit buttons get a btn btn-primary class added, and any other buttons get a btn btn-default class added.

Forms will still need some additional CSS styling (to set spacing) as the form's field_holders cannot be modified to the limitations mentioned above.

Features

It adds the form-control CSS class to all front-end:

  • TextField (and extended classes)
  • TextAreaField
  • DropdownField

It renders CheckboxSetField & OptionsetField with different field templates (see templates/Forms).

It does not:

  • Modify field holders (onBeforeRender() does not allow that)
  • Support FieldGroup (you'll need to use CSS to do that)
  • Apply bootstrap-specific CSS classes to form messages

Requirements

  • Silverstripe ^4 || ^5

Installation

Install via Composer

You can install it via composer with composer require axllent/silverstripe-bootstrap-forms

Basic usage

Simply install (and flush), add the checkbox CSS to your styles and you're good to go.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 7
  • 开发语言: PHP

其他信息

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