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

  • CompositeField
  • FieldGroup
  • FieldSet
  • HiddenFieldSet
  • SelectionGroup
  • Tab
  • TabSet
  • ToggleCompositeField
 1 <?php
 2 /**
 3  * Allows visibility of a group of fields to be toggled using '+' and '-' icons
 4  * @package forms
 5  * @subpackage fields-structural
 6  */
 7 class ToggleCompositeField extends CompositeField {
 8     
 9     /**
10      * @var $headingLevel int
11      */
12     public $headingLevel = 2;
13     
14     function __construct($name, $title, $children) {
15         $this->name = $name;
16         $this->title = $title;
17 
18         $this->startClosed(true);
19         
20         parent::__construct($children);
21     }
22     
23     public function FieldHolder() {
24         Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/prototype/prototype.js");
25         Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/behaviour/behaviour.js");
26         Requirements::javascript(SAPPHIRE_DIR . "/javascript/prototype_improvements.js");
27         Requirements::javascript(SAPPHIRE_DIR . "/javascript/ToggleCompositeField.js");
28         
29         return $this->renderWith("ToggleCompositeField");
30     }   
31     
32     /**
33      * Determines if the field should render open or closed by default.
34      * 
35      * @param boolean
36      */
37     public function startClosed($bool) {
38         ($bool) ? $this->addExtraClass('startClosed') : $this->removeExtraClass('startClosed');
39     }
40     
41     /**
42      * @return String
43      */
44     public function HeadingLevel() {
45         return $this->headingLevel;
46     }
47 
48     public function Type() {
49         return ' toggleCompositeField';
50     }
51 }
52 
53 ?>
[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