mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
MINOR Added public keyword for methods (style guidelines)
This commit is contained in:
parent
c036af79ab
commit
816edabd3f
@ -13,7 +13,7 @@ class FieldEditor extends FormField {
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
function FieldHolder() {
|
||||
public function FieldHolder() {
|
||||
return $this->renderWith("FieldEditor");
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ class FieldEditor extends FormField {
|
||||
*
|
||||
* @return ViewableData_Customised
|
||||
*/
|
||||
function performReadonlyTransformation() {
|
||||
public function performReadonlyTransformation() {
|
||||
$clone = clone $this;
|
||||
$clone->readonly = true;
|
||||
$fields = $clone->Fields();
|
||||
@ -62,7 +62,7 @@ class FieldEditor extends FormField {
|
||||
*
|
||||
* @return DataObjectSet
|
||||
*/
|
||||
function Fields() {
|
||||
public function Fields() {
|
||||
// Don't return any fields unless we actually have the dependent parameters set on the form field
|
||||
if($this->form && $this->form->getRecord() && $this->name) {
|
||||
$relationName = $this->name;
|
||||
@ -89,7 +89,7 @@ class FieldEditor extends FormField {
|
||||
*
|
||||
* @return DataObjectSet
|
||||
*/
|
||||
function CreatableFields() {
|
||||
public function CreatableFields() {
|
||||
$fields = ClassInfo::subclassesFor('EditableFormField');
|
||||
|
||||
if($fields) {
|
||||
@ -117,7 +117,7 @@ class FieldEditor extends FormField {
|
||||
*
|
||||
* @param DataObject Record to Save it In
|
||||
*/
|
||||
function saveInto(DataObject $record) {
|
||||
public function saveInto(DataObject $record) {
|
||||
$name = $this->name;
|
||||
$fieldSet = $record->$name();
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
class SubmittedFormReportField extends FormField {
|
||||
|
||||
function Field() {
|
||||
public function Field() {
|
||||
Requirements::css(FRAMEWORK_DIR . "/css/SubmittedFormReportField.css");
|
||||
Requirements::javascript("userforms/javascript/UserForm.js");
|
||||
return $this->renderWith("SubmittedFormReportField");
|
||||
@ -18,7 +18,7 @@ class SubmittedFormReportField extends FormField {
|
||||
*
|
||||
* @return ComponentSet
|
||||
*/
|
||||
function Submissions() {
|
||||
public function Submissions() {
|
||||
$pageStart = isset($_REQUEST['start']) && is_numeric($_REQUEST['start']) ? $_REQUEST['start'] : 0;
|
||||
$pageLength = 10;
|
||||
|
||||
@ -37,7 +37,7 @@ class SubmittedFormReportField extends FormField {
|
||||
return $items;
|
||||
}
|
||||
|
||||
function getSubmissions() {
|
||||
public function getSubmissions() {
|
||||
return $this->customise(array(
|
||||
'Submissions' => $this->Submissions()
|
||||
))->renderWith(array('SubmittedFormReportField'));
|
||||
@ -48,7 +48,7 @@ class SubmittedFormReportField extends FormField {
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
function RecordID() {
|
||||
public function RecordID() {
|
||||
return $this->form->getRecord()->ID;
|
||||
}
|
||||
|
||||
|
@ -221,8 +221,8 @@ class UserDefinedForm extends Page {
|
||||
*
|
||||
* @return Page
|
||||
*/
|
||||
public function duplicate() {
|
||||
$page = parent::duplicate();
|
||||
public function duplicate($doWrite = true) {
|
||||
$page = parent::duplicate($doWrite);
|
||||
|
||||
// the form fields
|
||||
if($this->Fields()) {
|
||||
@ -329,7 +329,7 @@ class UserDefinedForm_Controller extends Page_Controller {
|
||||
*
|
||||
* @return Form|false
|
||||
*/
|
||||
function Form() {
|
||||
public function Form() {
|
||||
$fields = $this->getFormFields();
|
||||
if(!$fields) return false;
|
||||
|
||||
@ -359,7 +359,7 @@ class UserDefinedForm_Controller extends Page_Controller {
|
||||
*
|
||||
* @return FieldSet
|
||||
*/
|
||||
function getFormFields() {
|
||||
public function getFormFields() {
|
||||
$fields = new FieldList();
|
||||
|
||||
if($this->Fields()) {
|
||||
@ -417,7 +417,7 @@ class UserDefinedForm_Controller extends Page_Controller {
|
||||
*
|
||||
* @return FieldSet
|
||||
*/
|
||||
function getFormActions() {
|
||||
public function getFormActions() {
|
||||
$submitText = ($this->SubmitButtonText) ? $this->SubmitButtonText : _t('UserDefinedForm.SUBMITBUTTON', 'Submit');
|
||||
|
||||
$actions = new FieldList(
|
||||
@ -439,7 +439,7 @@ class UserDefinedForm_Controller extends Page_Controller {
|
||||
*
|
||||
* @return RequiredFields
|
||||
*/
|
||||
function getRequiredFields() {
|
||||
public function getRequiredFields() {
|
||||
$required = new RequiredFields();
|
||||
|
||||
$rules = array();
|
||||
@ -496,7 +496,7 @@ JS
|
||||
* Allows complex rules to be created
|
||||
* @return void
|
||||
*/
|
||||
function generateConditionalJavascript() {
|
||||
public function generateConditionalJavascript() {
|
||||
$default = "";
|
||||
$rules = "";
|
||||
|
||||
@ -625,7 +625,7 @@ JS
|
||||
* @param Array array to convert
|
||||
* @return JSON
|
||||
*/
|
||||
function array2json($array) {
|
||||
public function array2json($array) {
|
||||
foreach($array as $key => $value)
|
||||
if(is_array( $value )) {
|
||||
$result[] = "$key:" . $this->array2json($value);
|
||||
@ -643,7 +643,7 @@ JS
|
||||
* @param Form Form
|
||||
* @return Redirection
|
||||
*/
|
||||
function process($data, $form) {
|
||||
public function process($data, $form) {
|
||||
Session::set("FormInfo.{$form->FormName()}.data",$data);
|
||||
Session::clear("FormInfo.{$form->FormName()}.errors");
|
||||
|
||||
@ -797,7 +797,7 @@ JS
|
||||
*
|
||||
* @return ViewableData
|
||||
*/
|
||||
function finished() {
|
||||
public function finished() {
|
||||
$referrer = isset($_GET['referrer']) ? urldecode($_GET['referrer']) : null;
|
||||
|
||||
return $this->customise(array(
|
||||
@ -879,11 +879,11 @@ class UserDefinedForm_EmailRecipient extends DataObject {
|
||||
return $fields;
|
||||
}
|
||||
|
||||
function canEdit() {
|
||||
public function canEdit() {
|
||||
return $this->Form()->canEdit();
|
||||
}
|
||||
|
||||
function canDelete() {
|
||||
public function canDelete() {
|
||||
return $this->Form()->canDelete();
|
||||
}
|
||||
}
|
||||
@ -899,7 +899,7 @@ class UserDefinedForm_SubmittedFormEmail extends Email {
|
||||
protected $ss_template = "SubmittedFormEmail";
|
||||
protected $data;
|
||||
|
||||
function __construct() {
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
@ -13,7 +13,7 @@ class EditableCheckboxGroupField extends EditableMultipleOptionField {
|
||||
|
||||
static $plural_name = "Checkbox Groups";
|
||||
|
||||
function getFormField() {
|
||||
public function getFormField() {
|
||||
$optionSet = $this->Options();
|
||||
$options = array();
|
||||
|
||||
@ -22,7 +22,7 @@ class EditableCheckboxGroupField extends EditableMultipleOptionField {
|
||||
return new CheckboxSetField($this->Name, $this->Title, $optionMap);
|
||||
}
|
||||
|
||||
function getValueFromData($data) {
|
||||
public function getValueFromData($data) {
|
||||
$result = '';
|
||||
$entries = (isset($data[$this->Name])) ? $data[$this->Name] : false;
|
||||
|
||||
|
@ -13,7 +13,7 @@ class EditableDateField extends EditableFormField {
|
||||
|
||||
static $plural_name = 'Date Fields';
|
||||
|
||||
function getFieldConfiguration() {
|
||||
public function getFieldConfiguration() {
|
||||
$default = ($this->getSetting('DefaultToToday')) ? $this->getSetting('DefaultToToday') : false;
|
||||
$label = _t('EditableFormField.DEFAULTTOTODAY', 'Default to Today?');
|
||||
|
||||
@ -22,7 +22,7 @@ class EditableDateField extends EditableFormField {
|
||||
);
|
||||
}
|
||||
|
||||
function populateFromPostData($data) {
|
||||
public function populateFromPostData($data) {
|
||||
$fieldPrefix = 'Default-';
|
||||
|
||||
if(empty($data['Default']) && !empty($data[$fieldPrefix.'Year']) && !empty($data[$fieldPrefix.'Month']) && !empty($data[$fieldPrefix.'Day'])) {
|
||||
|
@ -16,7 +16,7 @@ class EditableDropdown extends EditableMultipleOptionField {
|
||||
/**
|
||||
* @return DropdownField
|
||||
*/
|
||||
function getFormField() {
|
||||
public function getFormField() {
|
||||
$optionSet = $this->Options();
|
||||
$options = array();
|
||||
|
||||
|
@ -13,7 +13,7 @@ class EditableEmailField extends EditableFormField {
|
||||
|
||||
static $plural_name = 'Email Fields';
|
||||
|
||||
function getFormField() {
|
||||
public function getFormField() {
|
||||
return new EmailField($this->Name, $this->Title);
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ class EditableFormField extends DataObject {
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
function EditSegment() {
|
||||
public function EditSegment() {
|
||||
return $this->renderWith('EditableFormField');
|
||||
}
|
||||
|
||||
@ -113,7 +113,7 @@ class EditableFormField extends DataObject {
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function getShowOnLoad() {
|
||||
public function getShowOnLoad() {
|
||||
return ($this->getSetting('ShowOnLoad') == "Show" || $this->getSetting('ShowOnLoad') == '') ? true : false;
|
||||
}
|
||||
|
||||
@ -260,7 +260,7 @@ class EditableFormField extends DataObject {
|
||||
*
|
||||
* @return TextField
|
||||
*/
|
||||
function TitleField() {
|
||||
public function TitleField() {
|
||||
$label = _t('EditableFormField.ENTERQUESTION', 'Enter Question');
|
||||
|
||||
$field = new TextField('Title', $label, $this->getField('Title'));
|
||||
@ -274,7 +274,7 @@ class EditableFormField extends DataObject {
|
||||
}
|
||||
|
||||
/** Returns the Title for rendering in the front-end (with XML values escaped) */
|
||||
function getTitle() {
|
||||
public function getTitle() {
|
||||
return Convert::raw2att($this->getField('Title'));
|
||||
}
|
||||
|
||||
@ -443,7 +443,7 @@ class EditableFormField extends DataObject {
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function showInReports() {
|
||||
public function showInReports() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class EditableFormHeading extends EditableFormField {
|
||||
|
||||
static $plural_name = 'Headings';
|
||||
|
||||
function getFieldConfiguration() {
|
||||
public function getFieldConfiguration() {
|
||||
$levels = array(
|
||||
'1' => '1',
|
||||
'2' => '2',
|
||||
@ -37,18 +37,18 @@ class EditableFormHeading extends EditableFormField {
|
||||
return $options;
|
||||
}
|
||||
|
||||
function getFormField() {
|
||||
public function getFormField() {
|
||||
$labelField = new HeaderField($this->Name,$this->Title, $this->getSetting('Level'));
|
||||
$labelField->addExtraClass('FormHeading');
|
||||
|
||||
return $labelField;
|
||||
}
|
||||
|
||||
function showInReports() {
|
||||
public function showInReports() {
|
||||
return false;
|
||||
}
|
||||
|
||||
function getFieldValidationOptions() {
|
||||
public function getFieldValidationOptions() {
|
||||
return false;
|
||||
}
|
||||
}
|
@ -13,7 +13,7 @@ class EditableLiteralField extends EditableFormField {
|
||||
|
||||
static $plural_name = 'HTML Blocks';
|
||||
|
||||
function getFieldConfiguration() {
|
||||
public function getFieldConfiguration() {
|
||||
return new FieldList(
|
||||
new TextareaField(
|
||||
$this->getSettingName('Content'),
|
||||
@ -27,7 +27,7 @@ class EditableLiteralField extends EditableFormField {
|
||||
);
|
||||
}
|
||||
|
||||
function getFormField() {
|
||||
public function getFormField() {
|
||||
return new LiteralField("LiteralField[$this->ID]",
|
||||
"<div id='$this->Name' class='field text'>
|
||||
<label class='left'>$this->Title</label>
|
||||
@ -36,7 +36,7 @@ class EditableLiteralField extends EditableFormField {
|
||||
);
|
||||
}
|
||||
|
||||
function showInReports() {
|
||||
public function showInReports() {
|
||||
return (!$this->getSetting('HideFromReports'));
|
||||
}
|
||||
}
|
@ -11,7 +11,7 @@ class EditableMemberListField extends EditableFormField {
|
||||
|
||||
static $plural_name = 'Member List Fields';
|
||||
|
||||
function getFieldConfiguration() {
|
||||
public function getFieldConfiguration() {
|
||||
$groupID = ($this->getSetting('GroupID')) ? $this->getSetting('GroupID') : 0;
|
||||
$groups = DataObject::get("Group");
|
||||
|
||||
@ -24,7 +24,7 @@ class EditableMemberListField extends EditableFormField {
|
||||
return $fields;
|
||||
}
|
||||
|
||||
function getFormField() {
|
||||
public function getFormField() {
|
||||
if ($this->getSetting('GroupID')) {
|
||||
$members = Member::mapInGroups($this->getSetting('GroupID'));
|
||||
|
||||
@ -34,7 +34,7 @@ class EditableMemberListField extends EditableFormField {
|
||||
return false;
|
||||
}
|
||||
|
||||
function getValueFromData($data) {
|
||||
public function getValueFromData($data) {
|
||||
if(isset($data[$this->Name])) {
|
||||
$value = Convert::raw2sql($data[$this->Name]);
|
||||
|
||||
|
@ -13,7 +13,7 @@ class EditableRadioField extends EditableMultipleOptionField {
|
||||
|
||||
static $plural_name = 'Radio fields';
|
||||
|
||||
function getFormField() {
|
||||
public function getFormField() {
|
||||
$optionSet = $this->Options();
|
||||
$options = array();
|
||||
|
||||
|
@ -13,7 +13,7 @@ class EditableTextField extends EditableFormField {
|
||||
|
||||
static $plural_name = 'Text Fields';
|
||||
|
||||
function getFieldConfiguration() {
|
||||
public function getFieldConfiguration() {
|
||||
$fields = parent::getFieldConfiguration();
|
||||
|
||||
$min = ($this->getSetting('MinLength')) ? $this->getSetting('MinLength') : '';
|
||||
@ -37,7 +37,7 @@ class EditableTextField extends EditableFormField {
|
||||
/**
|
||||
* @return TextareaField|TextField
|
||||
*/
|
||||
function getFormField() {
|
||||
public function getFormField() {
|
||||
if($this->getSetting('Rows') && $this->getSetting('Rows') > 1) {
|
||||
return new TextareaField($this->Name, $this->Title, $this->getSetting('Rows'));
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ class SubmittedFileField extends SubmittedFormField {
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getFormattedValue() {
|
||||
public function getFormattedValue() {
|
||||
$link = $this->getLink();
|
||||
$title = _t('SubmittedFileField.DOWNLOADFILE', 'Download File');
|
||||
|
||||
@ -34,7 +34,7 @@ class SubmittedFileField extends SubmittedFormField {
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getLink() {
|
||||
public function getLink() {
|
||||
if($file = $this->UploadedFile()) {
|
||||
if(trim($file->getFilename(), '/') != trim(ASSETS_DIR,'/')) {
|
||||
return $this->UploadedFile()->URL;
|
||||
|
@ -24,7 +24,7 @@ class SubmittedFormField extends DataObject {
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
function getFormattedValue() {
|
||||
public function getFormattedValue() {
|
||||
return nl2br($this->dbObject('Value')->ATT());
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ class UserFormsVersionedTask extends MigrationTask {
|
||||
* Publish the existing forms.
|
||||
*
|
||||
*/
|
||||
function run($request) {
|
||||
public function run($request) {
|
||||
$forms = Versioned::get_by_stage('UserDefinedForm', 'Live');
|
||||
|
||||
if($forms) {
|
||||
|
@ -40,7 +40,7 @@ class FieldEditorTest extends FunctionalTest {
|
||||
|
||||
class FieldEditorTest_Controller extends Controller {
|
||||
|
||||
function Form() {
|
||||
public function Form() {
|
||||
return new Form($this, 'Form', new FieldList(new FieldEditor('Fields')), new FieldList());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user