2017 © Pedro Peláez
 

symfony1-plugin sf-form-i18n-number-plugin

I18n-Number validator and widget for Symfony1

image

fos1/sf-form-i18n-number-plugin

I18n-Number validator and widget for Symfony1

  • Tuesday, October 6, 2015
  • by thepanz
  • Repository
  • 3 Watchers
  • 1 Stars
  • 38 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 3 % Grown

The README.md

sfFormI18nNumberPlugin

The sfFormI18nNumberPlugin is a Symfony1 plugin that provides an widget and validator for internationalized numbers., (*1)

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:, (*2)

  "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:, (*3)

before, (*4)

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

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

after, (*5)

  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., (*6)

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

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

The Versions

06/10 2015

1.x-dev

1.9999999.9999999.9999999-dev

I18n-Number validator and widget for Symfony1

  Sources   Download

MIT

The Requires

 

by Emanuele Panzeri
by oweitman

20/08 2015

v1.0.0

1.0.0.0

I18n-Number validator and widget for Symfony1

  Sources   Download

MIT

The Requires

 

by Emanuele Panzeri
by oweitman