2017 © Pedro Peláez
 

library money

Tag form widget for OctoberCMS.

image

owl/money

Tag form widget for OctoberCMS.

  • Friday, February 27, 2015
  • by scottbedard
  • Repository
  • 2 Watchers
  • 2 Stars
  • 427 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 1 Versions
  • 1 % Grown

The README.md

Money

Money form widget for OctoberCMS., (*1)

Packagist, (*2)

Installation

To install the Money widget with your plugin, add the following to your plugin's composer.json file., (*3)

"require": {
    "owl/money": "~1.0@dev"
}

Next, register the widget in your plugin's Plugin.php file., (*4)

public function registerFormWidgets()
{
    return [
        'Owl\FormWidgets\Money\Widget' => [
            'label' => 'Money',
            'code' => 'owl-money'
        ],
    ];
}

Usage

To use the Money widget, simply declare a field type as owl-money, (*5)

price:
    label: Price
    type: owl-money

There are several parameters that can be used to customize the money widget. Defining a thousands or decimal will change the thousands and decimal characters. Defining a prefix or suffix string will allow you to add currency symbols before or after the input. Lastly, setting allowNegative to true will allow negative values to be submitted., (*6)

The below example will accept negative inputs with a USD prefix ($ -1,234.56), (*7)

price:
    label: Price
    type: owl-money
    prefix: "$ "
    allowNegative: true

You may need to define the widget configuration dynamically. For example, your plugin might have a variable currency symbol. This can be achieved like so..., (*8)

Config::set('owl.formwidgets::money', [
    'prefix'        => '$ ',
    'placeholder'   => '$ 0.00',
]);

The Versions

27/02 2015

dev-master

9999999-dev http://github.com/october-widgets

Tag form widget for OctoberCMS.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Scott Bedard

money owl october october cms