labelMore = _t('ToggleField.MORE', 'more'); $this->labelLess = _t('ToggleField.LESS', 'less'); $this->startClosed(true); parent::__construct($name, $title, $value); } public function Field($properties = array()) { $content = ''; Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.js'); Requirements::javascript(FRAMEWORK_DIR . "/javascript/ToggleField.js"); if($this->startClosed) $this->addExtraClass('startClosed'); $valforInput = $this->value ? Convert::raw2att($this->value) : ""; $rawInput = Convert::html2raw($valforInput); if($this->charNum) $reducedVal = substr($rawInput,0,$this->charNum); else $reducedVal = DBField::create_field('Text',$rawInput)->{$this->truncateMethod}(); // only create togglefield if the truncated content is shorter if(strlen($reducedVal) < strlen($rawInput)) { $content = << $reducedVal $this->labelMore