| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 | <?php/** * * PHP Pro Bid $Id$ PQlOVT8VN+GJbUzl3YYn3qhpJ9/oJ9MUAf2Q2yGTnqk= * * @link        http://www.phpprobid.com * @copyright   Copyright (c) 2017 Online Ventures Software & CodeCube SRL * @license     http://www.phpprobid.com/license Commercial License * * @version     7.10 [rev.7.10.01] *//** * wysiwyg custom element * * uses redactor */namespace Ppb\Form\Element;use Cube\Form\Element\Textarea,    Cube\Controller\Front;class Wysiwyg extends Textarea{    const ELEMENT_CLASS = 'wysiwyg';    /**     *     * type of element - override the variable from the parent class     *     * @var string     */    protected $_element = 'wysiwyg';    /**     *     * class constructor     *     * @param string $name     */    public function __construct($name)    {        parent::__construct($name);        $baseUrl = Front::getInstance()->getRequest()->getBaseUrl();        $this->setHeaderCode('<link href="' . $baseUrl . '/js/redactor/redactor.custom.css" media="screen" rel="stylesheet" type="text/css">')            ->setBodyCode('<script type="text/javascript" src="' . $baseUrl . '/js/redactor/redactor.min.js"></script>');        $this->setBodyCode(            "<script type=\"text/javascript\">" . "\n"            . " $('." . self::ELEMENT_CLASS . "').redactor({ " . "\n"            . "     convertDivs: false, " . "\n"            . "     minHeight: 200 " . "\n"            . " }); " . "\n"            . "</script>");        $this->addAttribute('class', self::ELEMENT_CLASS);    }}
 |