XOOPS  2.6.0
SelectEditor.php
Go to the documentation of this file.
1 <?php
2 /*
3  You may not change or alter any portion of this comment or credits
4  of supporting developers from this source code or any supporting source code
5  which is considered copyrighted (c) material of the original comment or credit authors.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 */
11 
12 namespace Xoops\Form;
13 
26 {
30  public $allowed_editors = array();
31 
35  public $form;
36 
40  public $value;
41 
45  public $name;
46 
50  public $nohtml;
51 
61  public function __construct(
62  Form $form,
63  $name = 'editor',
64  $value = null,
65  $nohtml = false,
66  $allowed_editors = array()
67  ) {
68  parent::__construct(\XoopsLocale::A_SELECT);
69  $this->allowed_editors = $allowed_editors;
70  $this->form = $form;
71  $this->name = $name;
72  $this->value = $value;
73  $this->nohtml = $nohtml;
74  }
75 
81  public function render()
82  {
83  $editor_handler = \XoopsEditorHandler::getInstance();
84  $editor_handler->allowed_editors = $this->allowed_editors;
85  $option_select = new Select("", $this->name, $this->value);
86  $extra = 'onchange="if(this.options[this.selectedIndex].value.length > 0 ){window.document.forms.'
87  . $this->form->getName() . '.submit();}"';
88  $option_select->setExtra($extra);
89  $option_select->addOptionArray($editor_handler->getList($this->nohtml));
90  $this->addElement($option_select);
91  return parent::render();
92  }
93 }
$wizard form
const A_SELECT
Definition: en_US.php:125
addElement(Element $formElement, $required=false)
Definition: ElementTray.php:80
__construct(Form $form, $name= 'editor', $value=null, $nohtml=false, $allowed_editors=array())