silverstripe-framework/forms/TogglePanel.php
Ingo Schommer 4cb5bd719a wscott: Added some additional fixes & such to sapphire
TooglePanel? can be created initially closed 
PasswordField? honors a max size passed to it 
SiteTree? / Pages can now have custom meta tags 
Sitemap can deal with pinging google on updates, plus a couple other minor changes 


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@41690 467b73ca-7a2a-4603-9d3b-597d59a354a9
2007-09-14 00:47:00 +00:00

38 lines
921 B
PHP
Executable File

<?php
class TogglePanel extends CompositeField {
protected $closed = false;
function __construct($title, $children, $startClosed = false) {
$this->title = $title;
$this->closed = $startClosed;
$this->name = ereg_replace('[^A-Za-z0-9]','',$this->title);
parent::__construct($children);
}
public function FieldHolder() {
Requirements::javascript("jsparty/prototype.js");
Requirements::javascript("jsparty/behaviour.js");
Requirements::javascript("jsparty/prototype_improvements.js");
Requirements::javascript("sapphire/javascript/TogglePanel.js");
return $this->renderWith("TogglePanel");
}
public function setClosed($closed) {
$this->closed = $closed;
}
public function getClosed() {
return $this->closed;
}
public function ClosedClass() {
if($this->closed) return " closed";
}
public function ClosedStyle() {
if($this->closed) return "style=\"display: none\"";
}
}
?>