antonythorpe/silverstripe-formfieldadditionalclasses

This package is abandoned and no longer maintained. No replacement package was suggested.

Warning: there is an error in this module as it adds classes to all form fields. Abandoned. Through new methods on the FormField, CSS classes can be added to any Field Holder template. That is, to the opening div, Validation span, Middle Column/Description div, and Left/Right label.

dev-master / 1.x-dev 2022-02-27 19:39 UTC

This package is auto-updated.

Last update: 2022-02-27 19:40:02 UTC


README

Warning: there is an error in this module as it adds classes to all form fields. Abandoned. Through new methods on the FormField, CSS classes can be added to any Field Holder template. That is, to the opening div, Validation span, Middle Column/Description div, and Left/Right label.

Build Status Scrutinizer Code Quality Latest Stable Version Total Downloads Latest Unstable Version License

Why use this Silverstripe module?

For styling of Form Fields

How it works

Extends the FormField class

Example

    CheckboxField::create('Example', 'Checkbox Example')
        ->addHolderClass('form-check')
        ->addRightLabelClass('form-check-label')
        ->addExtraClass('form-check-input') // note: existing SilverStripe functionality
        ->addHolderValidationMessageClass('alert alert-danger')
        ->addHolderDescriptionClass('blueday');

Would create:

    <div id="Form_Form_CheckboxFieldExample_Holder" class="field checkbox form-check">
        <input type="checkbox" name="Example" value="1" class="checkbox form-check-input" id="Form_Form_Example">
        <label class="right form-check-label" for="Form_Form_Example">Checkbox Example</label>
        <span class="message alert alert-danger bad">Opps!</span>
        <span class="description blueday">Helpful note to the user</span>
    </div>

Approach of this Module

The classes in this module mostly apply to the Field Holder template. The central $Field remains untouched (the existing SilverStripe function addExtraClass can be used to add CSS classes to this). Note: the addExtraClass has been removed from the holder templates now that there are new methods to use. In addition, default classes are in place that match the existing classes in the SilverStripe holder templates so there should not be too much carnage when installing this module into an existing project.

Requirements

Silverstripe

Documentation

Index

Pull Requests are Welcome

Feel free to send a pull request. Please don't forget the tests!

Support

None sorry.

Change Log

Link

Contributions

Link

License

MIT