public function alterTextarea(MethodInvocation $invocation)
    {
        $helper = $invocation->getThis();
        list($fieldName, $options) = array_pad($invocation->getArguments(), 2, null);

        if (!empty($options['class']) &&
            strpos($options['class'], 'ckeditor') !== false &&
            $helper instanceof FormHelper
        ) {
            static::$_counter++;
            $editorId = 'ck-editor-' . static::$_counter;
            $options['class'] .= ' ' . $editorId;
            $view = $this->getProperty($helper, '_View');

            if (!static::$_scriptsLoaded) {
                static::$_scriptsLoaded = true;
                $filebrowserBrowseUrl = $view->Url->build(['plugin' => 'Wysiwyg', 'controller' => 'finder']);
                $view->Html->script('Wysiwyg./ckeditor/ckeditor.js', ['block' => true]);
                $view->Html->script('Wysiwyg./ckeditor/adapters/jquery.js', ['block' => true]);
                $view->Html->scriptBlock('$(document).ready(function () {
                    CKEDITOR.editorConfig = function(config) {
                        config.filebrowserBrowseUrl = "' . $filebrowserBrowseUrl . '";
                    };
                });', ['block' => true]);
                $this->_includeLinksToContents($view);
            }
        }

        $this->setProperty($invocation, 'arguments', [$fieldName, $options]);

        return $invocation->proceed();
    }
public function alterTextarea(MethodInvocation $invocation)
    {
        $helper = $invocation->getThis();
        list($fieldName, $options) = array_pad($invocation->getArguments(), 2, null);

        if (!empty($options['class']) &&
            strpos($options['class'], 'ckeditor') !== false &&
            $helper instanceof FormHelper
        ) {
            static::$_counter++;
            $editorId = 'ck-editor-' . static::$_counter;
            $options['class'] .= ' ' . $editorId;
            $view = $this->getProperty($helper, '_View');

            if (!static::$_scriptsLoaded) {
                static::$_scriptsLoaded = true;
                $filebrowserBrowseUrl = $view->Url->build(['plugin' => 'Wysiwyg', 'controller' => 'finder']);
                $view->Html->script('Wysiwyg./ckeditor/ckeditor.js', ['block' => true]);
                $view->Html->script('Wysiwyg./ckeditor/adapters/jquery.js', ['block' => true]);
                $view->Html->scriptBlock('$(document).ready(function () {
                    CKEDITOR.editorConfig = function(config) {
                        config.filebrowserBrowseUrl = "' . $filebrowserBrowseUrl . '";
                    };
                });', ['block' => true]);
                $this->_includeLinksToContents($view);
            }
        }

        $this->setProperty($invocation, 'arguments', [$fieldName, $options]);

        return $invocation->proceed();
    }
public function alterTextarea ( MethodInvocation $ invocation ) { $ helper = $ invocation -> getThis ( ) ; list ( $ fieldName , $ options ) = array_pad ( $ invocation -> getArguments ( ) , 2 , null ) ; if ( ! empty ( $ options [ 'class' ] ) && strpos ( $ options [ 'class' ] , 'ckeditor' ) !== false && $ helper instanceof FormHelper ) { static :: $ _counter ++ ; $ editorId = 'ck-editor-' . static :: $ _counter ; $ options [ 'class' ] .= ' ' . $ editorId ; $ view = $ this -> getProperty ( $ helper , '_View' ) ; if ( ! static :: $ _scriptsLoaded ) { static :: $ _scriptsLoaded = true ; $ filebrowserBrowseUrl = $ view -> Url -> build ( [ 'plugin' => 'Wysiwyg' , 'controller' => 'finder' ] ) ; $ view -> Html -> script ( 'Wysiwyg./ckeditor/ckeditor.js' , [ 'block' => true ] ) ; $ view -> Html -> script ( 'Wysiwyg./ckeditor/adapters/jquery.js' , [ 'block' => true ] ) ; $ view -> Html -> scriptBlock ( '$(document).ready(function () {
                    CKEDITOR.editorConfig = function(config) {
                        config.filebrowserBrowseUrl = "' . $ filebrowserBrowseUrl . '";
                    };
                });' , [ 'block' => true ] ) ; $ this -> _includeLinksToContents ( $ view ) ; } } $ this -> setProperty ( $ invocation , 'arguments' , [ $ fieldName , $ options ] ) ; return $ invocation -> proceed ( ) ; }
Converts the given text area into a WYSIWYG editor.

@param \Go\Aop\Intercept\MethodInvocation $invocation Invocation
@Around("execution(public CMS\View\Helper\FormHelper->textarea(*))")
@return bool Whether object invocation should proceed or not
Converts the given text area into a WYSIWYG editor .