/** * Link to add content to the focused textarea * @param string $title The content to be wrapped by <a> tags * @param string $fieldName This should be "Modelname.fieldname" or specific domId as #id * @param mixed $content String or array of markItUp! options (openWith, closeWith, replaceWith, placeHolder and more. See markItUp! documentation for more details : http://markitup.jaysalvat.com/documentation * @param array $htmlAttributes Array of HTML attributes * @param string $confirmMessage JavaScript confirmation message * @return string An <a /> element */ public function insert($title, $fieldName = null, $content = array(), $htmlAttributes = array(), $confirmMessage = false) { if (isset($fieldName)) { $content['target'] = $fieldName[0] === '#' ? $fieldName : '#' . parent::domId($fieldName); } if (!is_array($content)) { $content['replaceWith'] = $content; } $properties = ''; foreach ($content as $k => $v) { $properties .= $k . ':"' . addslashes($v) . '",'; } $properties = substr($properties, 0, -1); $htmlAttributes = am($htmlAttributes, array('onclick' => '$.markItUp( { ' . $properties . ' } ); return false;')); return $this->Html->link($title, "#", $htmlAttributes, $confirmMessage, false); }
/** * Sets the $this->helper to the helper configured in the session * * @param View $View The View this helper is being attached to. * @param array $settings Configuration settings for the helper. * @return void **/ public function __construct(View $View, $settings = array()) { parent::__construct($View, $settings); $this->changeEditor($this->_helperOptions['_editor']); }