options; // we need to know the id for things the rich text editor // in advance of building the tag $id = _get_option($options, 'id', $this->name); $php_file = sfConfig::get('sf_rich_text_fck_js_dir').DIRECTORY_SEPARATOR.'fckeditor.php'; if (!is_readable(sfConfig::get('sf_web_dir').DIRECTORY_SEPARATOR.$php_file)) { throw new sfConfigurationException('You must install FCKEditor to use this helper (see rich_text_fck_js_dir settings).'); } // FCKEditor.php class is written with backward compatibility of PHP4. // This reportings are to turn off errors with public properties and already declared constructor $error_reporting = error_reporting(E_ALL); require_once(sfConfig::get('sf_web_dir').DIRECTORY_SEPARATOR.$php_file); // turn error reporting back to your settings error_reporting($error_reporting); $instance_id = 'fck_'.rand(0, 100); $fckeditor = new FCKeditor($instance_id); $fckeditor->BasePath = sfContext::getInstance()->getRequest()->getRelativeUrlRoot().'/'.sfConfig::get('sf_rich_text_fck_js_dir').'/'; $fckeditor->Value = $this->content; if (isset($options['width'])) { $fckeditor->Width = $options['width']; } elseif (isset($options['cols'])) { $fckeditor->Width = (string)((int) $options['cols'] * 10).'px'; } if (isset($options['height'])) { $fckeditor->Height = $options['height']; } elseif (isset($options['rows'])) { $fckeditor->Height = (string)((int) $options['rows'] * 10).'px'; } if (isset($options['tool'])) { $fckeditor->ToolbarSet = $options['tool']; } if (isset($options['config'])) { $fckeditor->Config['CustomConfigurationsPath'] = javascript_path($options['config']); } $content = $fckeditor->CreateHtml(); // fix for http://trac.symfony-project.com/ticket/732 // fields need to be of type text to be picked up by fillin. they are hidden by inline css anyway: // $content = str_replace('type="hidden"','type="text"',$content); $content = str_replace('name="'.$instance_id.'"','name="'.$this->name.'"',$content); return $content; } }