2015-08-04 07:12:17 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* A step in multi-page user form
|
|
|
|
*
|
|
|
|
* @package userforms
|
|
|
|
*/
|
|
|
|
class EditableFormStep extends EditableFormField {
|
|
|
|
|
2015-08-12 07:18:43 +02:00
|
|
|
private static $singular_name = 'Page Break';
|
|
|
|
|
|
|
|
private static $plural_name = 'Page Breaks';
|
|
|
|
|
2015-08-11 08:21:43 +02:00
|
|
|
/**
|
|
|
|
* Disable selection of step class
|
|
|
|
*
|
|
|
|
* @config
|
|
|
|
* @var bool
|
|
|
|
*/
|
|
|
|
private static $hidden = true;
|
|
|
|
|
2015-08-04 07:12:17 +02:00
|
|
|
/**
|
|
|
|
* @return FieldList
|
|
|
|
*/
|
|
|
|
public function getCMSFields() {
|
|
|
|
$fields = parent::getCMSFields();
|
|
|
|
|
2015-08-12 06:08:32 +02:00
|
|
|
$fields->removeByName(array('MergeField', 'Default', 'Validation', 'DisplayRules'));
|
2015-08-04 07:12:17 +02:00
|
|
|
|
|
|
|
return $fields;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return FormField
|
|
|
|
*/
|
|
|
|
public function getFormField() {
|
2015-08-12 06:08:32 +02:00
|
|
|
$field = UserFormsStepField::create()
|
2015-08-10 07:03:36 +02:00
|
|
|
->setTitle($this->EscapedTitle);
|
|
|
|
$this->doUpdateFormField($field);
|
|
|
|
return $field;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function updateFormField($field) {
|
|
|
|
// if this field has an extra class
|
|
|
|
if($field->ExtraClass) {
|
|
|
|
$field->addExtraClass($field->ExtraClass);
|
|
|
|
}
|
2015-08-04 07:12:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return boolean
|
|
|
|
*/
|
|
|
|
public function showInReports() {
|
|
|
|
return false;
|
|
|
|
}
|
2015-08-12 06:08:32 +02:00
|
|
|
|
|
|
|
public function getInlineClassnameField($column, $fieldClasses) {
|
|
|
|
return new LabelField(
|
|
|
|
$column,
|
2015-08-12 07:18:43 +02:00
|
|
|
$this->CMSTitle
|
2015-08-12 06:08:32 +02:00
|
|
|
);
|
|
|
|
}
|
2015-08-12 07:18:43 +02:00
|
|
|
|
|
|
|
public function getCMSTitle() {
|
|
|
|
$title = $this->i18n_singular_name();
|
|
|
|
if($this->Title) {
|
|
|
|
$title .= ' (' . $this->Title . ')';
|
|
|
|
}
|
|
|
|
return $title;
|
|
|
|
}
|
2015-08-04 07:12:17 +02:00
|
|
|
}
|