2015-08-12 06:08:32 +02:00
|
|
|
<?php
|
|
|
|
|
2017-08-09 01:55:09 +02:00
|
|
|
namespace SilverStripe\UserForms\FormField;
|
|
|
|
|
2015-08-12 06:08:32 +02:00
|
|
|
/**
|
|
|
|
* Represents a page step in a form, which may contain form fields or other groups
|
|
|
|
*/
|
2016-07-21 07:53:59 +02:00
|
|
|
class UserFormsStepField extends UserFormsCompositeField
|
|
|
|
{
|
2017-08-11 01:33:06 +02:00
|
|
|
private static $casting = [
|
2016-07-21 07:53:59 +02:00
|
|
|
'StepNumber' => 'Int'
|
2017-08-11 01:33:06 +02:00
|
|
|
];
|
2015-08-13 01:31:37 +02:00
|
|
|
|
2016-07-21 07:53:59 +02:00
|
|
|
/**
|
|
|
|
* Numeric index (1 based) of this step
|
|
|
|
*
|
|
|
|
* Null if unassigned
|
|
|
|
*
|
|
|
|
* @var int|null
|
|
|
|
*/
|
|
|
|
protected $number = null;
|
2015-08-13 01:31:37 +02:00
|
|
|
|
2017-08-11 01:33:06 +02:00
|
|
|
public function FieldHolder($properties = [])
|
2016-07-21 07:53:59 +02:00
|
|
|
{
|
|
|
|
return $this->Field($properties);
|
|
|
|
}
|
2015-08-13 01:31:37 +02:00
|
|
|
|
2016-07-21 07:53:59 +02:00
|
|
|
/**
|
|
|
|
* Get the step number
|
|
|
|
*
|
|
|
|
* @return int|null
|
|
|
|
*/
|
|
|
|
public function getStepNumber()
|
|
|
|
{
|
|
|
|
return $this->number;
|
|
|
|
}
|
2015-08-13 01:31:37 +02:00
|
|
|
|
2016-07-21 07:53:59 +02:00
|
|
|
/**
|
|
|
|
* Re-assign this step to another number
|
|
|
|
*
|
|
|
|
* @param type $number
|
|
|
|
* @return $this
|
|
|
|
*/
|
|
|
|
public function setStepNumber($number)
|
|
|
|
{
|
|
|
|
$this->number = $number;
|
|
|
|
return $this;
|
|
|
|
}
|
2015-08-12 06:08:32 +02:00
|
|
|
}
|