spekulatius/silverstripe-timezones 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

spekulatius/silverstripe-timezones

最新稳定版本:1.0.1

Composer 安装命令:

composer require spekulatius/silverstripe-timezones

包简介

Provides time zone data as well as a pre-populated dropdown field for SilverStripe

README 文档

README

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

Provides a reusable model and data of the time zones worldwide. In addition a dropdown field for a time zones selection is included.

Requirements

  • SilverStripe Framework 4.0

Installation

For the installation you can either download the package, unzip it into your project directory and run dev build manually or run the following commands in your project directory:

composer require spekulatius/silverstripe-timezones
./vendor/bin/sake dev/build

The data will automatically populated on dev build.

Provided Data

The provided data comes from PHPs built-in function timezone_identifiers_list(). Before the data gets saved in the db it will be prepared so its ready to be used.

Dropdown Field

If you want to use the dropdown field you can simply add a timezone to your db fields:

<?php
use Spekulatius\TimeZones\Model\FieldType\TimeZone;
use Spekulatius\TimeZones\Forms\TimeZoneField;

class MyPage extends Page
{
    /**
     * @var array
     */
    private static $db = array(
        'UserTimeZone' => TimeZone::class
    );

    /**
     * @return FieldList
     */
    public function getCMSFields()
    {
        $fields = parent::getCMSFields();

        // ...

        $fields->addFieldToTab(
            'Root.Main',
            TimeZoneField::create(
                'TimeZone',
                'My time zone'
            )
        );

        return $fields;
    }
}

Format of time zone

You can change the default format of the time zone in the dropdown menu by creating a file mysite/_config/timezone.yml and adding e.g.

SilverStripe\Core\Injector\Injector:
  Spekulatius\TimeZones\Model\TimeZoneData:
    properties:
      format: '%Name (%Region)'

You can use 'Name', 'Region' and 'Identifier' in the string and it will be replaced proper.

* [Future ideas/development, issues](https://github.com/spekulat/silverstripe-timezones/issues),
* [Contributing](https://github.com/spekulat/silverstripe-timezones/blob/master/CONTRIBUTING.md),
* [License](https://github.com/spekulat/silverstripe-timezones/blob/master/license.md)

This project is supported by bring your own ideas Ltd.. Bring Your Own Ideas Ltd. helps you to make your project ideas a reality.

bring your own ideas

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2015-06-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固