vulcandigital/silverstripe-birthdayfield

为 SilverStripe 定制的行内生日字段

安装: 133

依赖: 0

建议者: 0

安全性: 0

星标: 3

关注者: 2

分支: 0

开放问题: 0

类型:silverstripe-vendormodule

1.1.1 2018-02-01 06:05 UTC

This package is auto-updated.

Last update: 2024-09-18 20:07:20 UTC


README

要求

  • silverstripe/silverstripe-framework: ^4.0

安装

composer require vulcandigital/silverstripe-birthdayfield

用法

class BirthdayForm extends Form
{
    public function __construct(RequestHandler $controller = null, $name = self::DEFAULT_NAME)
    {
        $fields = FieldList::create([
            $birthday = BirthdayField::create('Birthday', 'Birthday')
        ]);

        $actions =  FieldList::create([
            FormAction::create('process', 'Submit Birthday')
        ]);

        $validator = RequiredFields::create([
            'Birthday'
        ]);

        parent::__construct($controller, $name, $fields, $actions, $validator);
    }
}

如果你希望它随列行内渲染(需要 Bootstrap v3)

$birthday->setBootstrapRender(true);

如果你想要禁用每个字段的单独标签并仅保留主标签

$birthday->disableTitles();

配置

Vulcan\BirthdayField\Forms\BirthdayField:
    # Change the output/read-only format display of the field
    format: 'Y-m-d'

许可证

BSD 3-Clause © Vulcan Digital Ltd