contributions/text.html/view/widgets/input/base/html.input.widget.php
Go to the documentation of this file.00001 <?php 00002 require_once GYRO_CORE_DIR . 'view/widgets/input/base/textarea.input.widget.php'; 00003 /** 00004 * A text area for HTML input 00005 * 00006 * To invoke it, use HtmlText::WIDGET as type for WidgetInput. 00007 * 00008 * Example: 00009 * @code 00010 * print WidgetInput::output('content', 'Edit post content:', $form_data, HtmlText::WIDGET, array('model' => 'posts', 'editor' => 'basic')); 00011 * @endcode 00012 * 00013 * This will create a textarea with classes "rte" and "rte_{EDITOR}" set. Given above example, this would be "rte rte_basic". 00014 * 00015 * The default value gets converted using the HtmlText::EDIT conversions. You may pass a model as parameter 'model', if you don't, 00016 * default conversions will be used. 00017 * 00018 * Additionally, rich text editors are enabled, if any are available. You may pass an editor config'name as parameter 'editor'. If none 00019 * is given, default configuration will be used. 00020 * 00021 * @author Gerd Riesselmann 00022 * @ingroup Html 00023 */ 00024 class InputWidgetHtmlBase extends InputWidgetTextareaBase { 00025 /** 00026 * Render the actual widget 00027 */ 00028 protected function render_input($attrs, $params, $name, $title, $value, $policy) { 00029 $model = Arr::get_item($params, 'model', HtmlText::CONVERSION_DEFAULT); 00030 $value = HtmlText::apply_conversion(HtmlText::EDIT, $value, $model); 00031 00032 $editor = Arr::get_item($params, 'editor', HtmlText::EDITOR_DEFAULT); 00033 HtmlText::enable_editor($editor); 00034 00035 $attrs['class'] = trim(Arr::get_item($attrs, 'class', '') . ' rte rte_' . strtolower($editor)); 00036 return parent::render_input($attrs, $params, $name, $title, $value, $policy); 00037 } 00038 }