__('Markup', __FILE__), 'summary' => __('Contains any other markup and optionally child Inputfields', __FILE__), 'version' => 101, 'permanent' => true, ); } public function init() { $this->set('markupText', ''); $this->set('textformatters', array()); $this->skipLabel = Inputfield::skipLabelBlank; parent::init(); } public function ___render() { $out = ''; if(strlen($this->attr('value'))) $out .= "\n" . $this->attr('value'); if(strlen($this->markupText)) $out .= "\n" . $this->markupText; $out = trim($out); if(count($this->textformatters)) { foreach($this->textformatters as $className) { $t = wire('modules')->get($className); if(!$t) continue; $t->formatValue(wire('page'), new Field(), $out); } } if($this->description) { $out = "\n

{$this->description}

" . $out; $this->description = ''; // prevents it from appearing again at the bottom } $out .= parent::___render(); return $out; } public function ___renderValue() { if(count($this->children)) return parent::___renderValue(); return null; } public function ___getConfigInputfields() { $inputfields = parent::___getConfigInputfields(); if($this->hasFieldtype) return $inputfields; $f = wire('modules')->get('InputfieldTextarea'); $f->attr('id+name', 'markupText'); $f->attr('value', $this->markupText); $f->attr('rows', 10); $f->label = $this->_('Markup Text'); $inputfields->add($f); $f = $this->modules->get('InputfieldAsmSelect'); $f->attr('id+name', 'textformatters'); $f->label = $this->_('Text Formatters'); foreach($this->modules->find("className^=Textformatter") as $textformatter) { $info = $textformatter->getModuleInfo(); $f->addOption($textformatter->className(), "$info[title]"); } $f->attr('value', $this->textformatters); $f->description = $this->_('Select the format that your Markup Text is in, or the formatters that you want to be applied to it, in the order you want them applied.'); $f->notes = $this->_('If your Markup Text is plain HTML, you may not want to select any Text Formatters.'); $inputfields->add($f); return $inputfields; } }