承接 fos1/sf-form-i18n-number-plugin 相关项目开发

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

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

fos1/sf-form-i18n-number-plugin

最新稳定版本:v1.1.0

Composer 安装命令:

composer require fos1/sf-form-i18n-number-plugin

包简介

I18n-Number validator and widget for Symfony1

README 文档

README

The sfFormI18nNumberPlugin is a Symfony1 plugin that provides an widget and validator for internationalized numbers.

Installation

Installation: Symfony 1

  • Install the plugin symfony plugin:install sfFormI18nNumberPlugin
  • Clear you cache symfony cc

Installation: Composer

Add the plugin your composer.json requirements:

  "require": {
    ...
    "fos1/sf-form-i18n-number-plugin": "1.0.*",
    ...

Usage

After you create in your schema a number-field with type double, float or decimal, change your form as follows:

before

public function configure() {
  // widgets
  $this->setWidgets(array(
    'number' => new sfWidgetFormInput(),
  ));

  // validators
  $this->setValidators(array(
    'number' => new sfValidatorNumber(),
  ));
}

after

  public function configure() {
    // widgets
    $this->setWidgets(array(
      'number' => new sfWidgetFormI18nNumber(),
    ));
    
    // validators
    $this->setValidators(array(
      'number' => new sfValidatorI18nNumber(),
    ));
  }

Configuration

The widget and the validator takes the culture to recognize, convert and display numbers from the user-session. If this is not possible or you want to use a different culture than the culture of the user session, you can set a option.

  // widgets
  $this->setWidgets(array(
    'number' => new sfWidgetFormI18nNumber(array('culture' => 'fr')),
  ));
        
  // validators
  $this->setValidators(array(
    'number' => new sfValidatorI18nNumber(array('culture' => 'fr')),
  ));

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-08-20