Download the PHP package purplespider/silverstripe-bootstrap-form-templates without Composer
On this page you can find all versions of the php package purplespider/silverstripe-bootstrap-form-templates. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download purplespider/silverstripe-bootstrap-form-templates
More information about purplespider/silverstripe-bootstrap-form-templates
Files in purplespider/silverstripe-bootstrap-form-templates
Package silverstripe-bootstrap-form-templates
Short Description Bootstap 5 form templates for Silverstripe 4
License BSD-3-Clause
Homepage https://github.com/purplespider/silverstripe-bootstrap-form-templates
Informations about the package silverstripe-bootstrap-form-templates
Bootstrap 5 Templates for Silverstripe 4
Introduction
This module aims to be a (mostly) unopinionated set of form templates to mark up Silverstripe frontend forms (both custom and Userforms) to be compatible with Bootstrap 5's form styles.
Maintainer Contact
- James Cocker ([email protected])
Requirements
- Silverstripe 4
- Bootstrap 5 already installed in your theme
Installation
-
Install using
composer
: ` -
Run
dev/build
- Add as the FIRST theme in your
app/_config/theme.yml
: `
e.g.: `
- To make Bootstrap's validation error styling work, add this SCSS to your theme: `
Opinionated SCSS (optional)
These are some opionated styles that I like to start with: `
Using Rows & Columns for Form Layout
By grouping fields into a row
using a FieldGroup
, you can then apply col
classes to fields, e.g.
``
How It Works
For full control, this module provides a complete set of form field templates, which override the default ones provided by Silverstripe and Userforms.
The templates are added as an extra theme to your site, so that they do not affect the form field in the CMS.
Handling of RightTitle
and Description
Any Description
text is added after the field, as per the default templates.
As the Userforms module uses RightTitle
and not Description
, this is also added after the field for consistency. So in your custom coded forms, you can use either (but you shouldn't use both).
Alternative Install (By Copying)
Rather than installing this via composer
as a module that can't be edited, you can also just copy the files into your theme, allowing to then make any customisations (e.g. moving Description
before the field.)
To do so, just copy the PurpleSpider
and SilverStripe
directories (within themes\bootstrap-form-templates\templates
) into your theme's templates
directory.
TODO
Please note: This module is currently a work-in-progress. I've still to:
- [ ] Check certain form fields for WAI compliance, such as radio and checkbox groups.
- [ ] Add styles for Userforms multi-page forms.
- [ ] Refine handling of "required" labels.
- [ ] Refine the ability to use
FormGroup
andaddExtraClass
to layout fields in rows and columns.