Webylon 3.1 API Docs
  • Package
  • Class
  • Tree
  • Deprecated
  • Download
Version: current
  • 3.2
  • 3.1

Packages

  • auth
  • Booking
  • cart
    • shipping
    • steppedcheckout
  • Catalog
  • cms
    • assets
    • batchaction
    • batchactions
    • bulkloading
    • comments
    • content
    • core
    • export
    • newsletter
    • publishers
    • reports
    • security
    • tasks
  • Dashboard
  • DataObjectManager
  • event
  • faq
  • forms
    • actions
    • core
    • fields-basic
    • fields-dataless
    • fields-datetime
    • fields-files
    • fields-formatted
    • fields-formattedinput
    • fields-relational
    • fields-structural
    • transformations
    • validators
  • googlesitemaps
  • guestbook
  • installer
  • newsletter
  • None
  • photo
    • gallery
  • PHP
  • polls
  • recaptcha
  • sapphire
    • api
    • bulkloading
    • control
    • core
    • cron
    • dev
    • email
    • fields-formattedinput
    • filesystem
    • formatters
    • forms
    • i18n
    • integration
    • misc
    • model
    • parsers
    • search
    • security
    • tasks
    • testing
    • tools
    • validation
    • view
    • widgets
  • seo
    • open
      • graph
  • sfDateTimePlugin
  • spamprotection
  • stealth
    • captha
  • subsites
  • userform
    • pagetypes
  • userforms
  • webylon
  • widgets

Classes

  • EditableCheckbox
  • EditableCheckboxGroupField
  • EditableCountryDropdownField
  • EditableDateField
  • EditableDropdown
  • EditableEmailField
  • EditableFileField
  • EditableFormField
  • EditableFormHeading
  • EditableHiddenField
  • EditableLiteralField
  • EditableMemberListField
  • EditableMultipleOptionField
  • EditableOption
  • EditableRadioField
  • EditableSiteAgreementField
  • EditableTextField
  • FieldEditor
  • SubmittedFileField
  • SubmittedForm
  • SubmittedFormField
  • SubmittedFormReportField
  • UserDefinedForm
  • UserDefinedForm_EmailRecipient
  • UserDefinedForm_SubmittedFormEmail
  • UserFormsVersionedTask
 1 <?php
 2 
 3 /**
 4  * Base Class for EditableOption Fields such as the ones used in 
 5  * dropdown fields and in radio check box groups
 6  * 
 7  * @package userforms
 8  */
 9 
10 class EditableOption extends DataObject {
11     
12     static $default_sort = "Sort";
13 
14     static $db = array(
15         "Name" => "Varchar(255)",
16         "Title" => "Varchar(255)",
17         "Default" => "Boolean",
18         "Sort" => "Int"
19     );
20     
21     static $has_one = array(
22         "Parent" => "EditableMultipleOptionField",
23     );
24     
25     static $extensions = array(
26         "Versioned('Stage', 'Live')"
27     );
28 
29     /**
30      * Template for the editing view of this option field
31      */
32     public function EditSegment() {
33         return $this->renderWith('EditableOption');
34     }
35 
36     /**
37      * The Title Field for this object
38      * 
39      * @return FormField
40      */
41     public function TitleField() {
42         return new TextField("Fields[{$this->ParentID}][{$this->ID}][Title]", null, $this->Title );
43     }
44 
45     /**
46      * Name of this field in the form
47      * 
48      * @return String
49      */
50     public function FieldName() {
51         return "Fields[{$this->ParentID}][{$this->ID}]";
52     }
53 
54     /**
55      * Populate this option from the form field
56      *
57      * @param Array Data
58      */
59     public function populateFromPostData($data) {
60         $this->Title = (isset($data['Title'])) ? $data['Title'] : "";
61         $this->Default = (isset($data['Default'])) ? $data['Default'] : "";
62         $this->Sort = (isset($data['Sort'])) ? $data['Sort'] : 0;
63         $this->write();
64     }
65     
66     /**
67      * Make this option readonly 
68      */
69     public function ReadonlyOption() {
70         $this->readonly = true;
71         return $this->EditSegment();
72     }
73 }
[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -
Webylon 3.1 API Docs API documentation generated by ApiGen 2.8.0