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

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

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

syntro/silverstripe-bootstrap-forms

最新稳定版本:6.0.1

Composer 安装命令:

composer require syntro/silverstripe-bootstrap-forms

包简介

Silverstripe module adding formfields for use in the frontend

README 文档

README

🎭 Tests codecov Dependabot phpstan composer Packagist Version

Silverstripe module for adding bootstrap forms to the frontend more easily.

Introduction

Creating forms compatible with the Bootstrap CSS framework using the provided form fields by Silverstripe is not an easy thing to do. Silverstripes' internally used form fields are not intended to be frontend fields in the first place, meaning the framework is very opinionated about how these fields are rendered in the admin UI and imposes these standards for frontend fields. These standards however are not very compatible with Bootstrap, especially Bootstrap v5.

To counter this, this module introduces a new set of fields, which behave like the originals, but render in a bootstrap compatible way. They also add a separate holderClasses attribute, which allows the easy formatting of forms using spacing classes.

Installation

To install this module, run the following command:

composer require syntro/silverstripe-bootstrap-forms

Usage

Quick Start

The following fields are available currently:

use Syntro\SilverstripeBootstrapForms\Forms\CheckboxField;
use Syntro\SilverstripeBootstrapForms\Forms\CheckboxSetField;
use Syntro\SilverstripeBootstrapForms\Forms\DropdownField;
use Syntro\SilverstripeBootstrapForms\Forms\EmailField;
use Syntro\SilverstripeBootstrapForms\Forms\OptionsetField;
use Syntro\SilverstripeBootstrapForms\Forms\TextareaField;
use Syntro\SilverstripeBootstrapForms\Forms\TextField;

// does not have the HolderClass trait
use Syntro\SilverstripeBootstrapForms\Forms\FieldGroup;

All fields have an extra set of methods, analogous the extraClass ones:

  • holderClass()
  • setupDefaultHolderClasses()
  • hasHolderClass($class)
  • addHolderClass($class)
  • removeHolderClass($class)

They behave the exact same way as their xxxExtraClass counterparts, but they control the class on the outer (holder) div.

Example

To create a good looking multi-column form, simply add the correct classes:

FieldGroup::create(
    TextField::create('Name', 'Your Name')->addHolderClass('col'),
    EmailField::create('Email', 'Email')->addHolderClass('col'),
    DropdownField::create(
        'choose',
        'Choose an option',
        [
            'yes' => 'Yes',
            'no' => 'No'
        ]
    )->addHolderClass('col'),
)->addExtraClass('row row-cols-1 row-cols-md-3'),

Docs

no docs yet

Contributing

See CONTRIBUTION.md for mor info.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2022-05-06