<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
janneklouman / silverstripe-spinner-field example snippets
SpinnerField::create(
// Field name
'Answer',
// Label
'What is the answer to the ultimate question of life, the universe, and everything?',
// Initial value
rand(0, 42),
// Optional options (see available options below under heading: UI settings)
[
'min' => 0,
'max' => 42,
'step' => 3 // Increment and decrement in steps of 3
]
);
// Setting a batch of options.
$spinnerField->setUIOptions(
[
'disabled' => true,
'max' => 314159265359,
'page' => 100000000000,
'icon_up' => 'ui-icon-plus',
'icon_down' => 'ui-icon-minus'
]
);
// On second thought...
$spinnerField->setUIOption('disabled', false);
// Available options and their default values
[
culture => null,
disabled => false,
icon_down => 'ui-icon-triangle-1-s',
icon_up => 'ui-icon-triangle-1-n',
incremental => true,
max => null,
min => null,
numberFormat => null, // Currently only 'n'||null is supported
page => 10,
step => 1
]
/**
* Enforce step validation. Will cause validation to fail if input is
* not evenly divisible with the 'step' UI option. Example: if 'step'
* is set to 4, validation will fail for 0 !== $input % 4
*
* @var bool
*/
protected $enforceStepValidation = false;
/**
* Will cause validation to fail if input is below the 'min' UI option.
*
* @var bool
*/
protected $enforceBelowMinValidation = true;
/**
* Will cause validation to fail if input is above the 'max' UI option.
*
* @var bool
*/
protected $enforceAboveMaxValidation = true;
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.