예제 #1
0
 public function appendFormatterSelect(SymphonyDOMElement $wrapper, $selected = NULL, $name = 'fields[format]', $label_value = null)
 {
     require_once LIB . '/class.textformatter.php';
     if (!$label_value) {
         $label_value = __('Text Formatter');
     }
     $label = Widget::Label($label_value);
     $document = $wrapper->ownerDocument;
     $options = array();
     $options[] = array(NULL, false, __('None'));
     $iterator = new TextFormatterIterator();
     if ($iterator->length() > 0) {
         foreach ($iterator as $pathname) {
             $handle = TextFormatter::getHandleFromFilename(basename($pathname));
             $tf = TextFormatter::load($pathname);
             $options[] = array($handle, $selected == $handle, constant(sprintf('%s::NAME', get_class($tf))));
         }
     }
     $label->appendChild(Widget::Select($name, $options));
     $wrapper->appendChild($label);
 }