Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Method browserAction does not exist #32

Open
afranioce opened this issue Jun 26, 2018 · 7 comments
Open

Error: Method browserAction does not exist #32

afranioce opened this issue Jun 26, 2018 · 7 comments

Comments

@afranioce
Copy link

Hi,

On open window to insert image in CKEditor

Url

http://127.0.0.1:8000/admin/sonata/media/media/browser?provider=sonata.media.provider.image&context=editor&CKEditor=question_data_text&CKEditorFuncNum=89&langCode=pt-br

Pakage

$ composer show --latest 'tilleuls/*'
tilleuls/ckeditor-sonata-media-bundle v1.0.8 v1.0.8 Integrates SonataMediaBundle with CKEditor

PHP version

$ php -v
PHP 7.2.7 (cli) (built: Jun 24 2018 18:52:09) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans

Sonata packages

$ composer show --latest 'sonata-project/*'
sonata-project/admin-bundle              3.35.2 3.35.2 The missing Symfony Admin Generator
sonata-project/block-bundle              3.12.1 3.12.1 Symfony SonataBlockBundle
sonata-project/cache                     2.0.1  2.0.1  Cache library
sonata-project/core-bundle               3.10.0 3.10.0 Symfony SonataCoreBundle
sonata-project/datagrid-bundle           2.3.1  2.3.1  Symfony SonataDatagridBundle
sonata-project/doctrine-extensions       1.0.2  1.0.2  Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.6.1  3.6.1  Symfony Sonata / Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/easy-extends-bundle       2.5.0  2.5.0  Symfony SonataEasyExtendsBundle
sonata-project/exporter                  1.9.0  1.9.0  Lightweight Exporter library
sonata-project/media-bundle              3.13.1 3.13.1 Symfony SonataMediaBundle
sonata-project/user-bundle               4.2.2  4.2.2  Symfony SonataUserBundle

Symfony packages

$ composer show --latest 'symfony/*'
symfony/asset                v4.1.0             v4.1.1             Symfony Asset Component
symfony/browser-kit          v4.1.0             v4.1.1             Symfony BrowserKit Component
symfony/cache                v4.1.0             v4.1.1             Symfony Cache component with PSR-6, PSR-16, and tags
symfony/class-loader         v3.4.11            v3.4.12            Symfony ClassLoader Component
symfony/config               v4.1.0             v4.1.1             Symfony Config Component
symfony/console              v4.1.0             v4.1.1             Symfony Console Component
symfony/css-selector         v4.1.0             v4.1.1             Symfony CssSelector Component
symfony/debug                v4.1.0             v4.1.1             Symfony Debug Component
symfony/debug-bundle         v4.1.0             v4.1.1             Symfony DebugBundle
symfony/debug-pack           v1.0.5             v1.0.5             A debug pack for Symfony projects
symfony/dependency-injection v4.1.0             v4.1.1             Symfony DependencyInjection Component
symfony/doctrine-bridge      v4.1.0             v4.1.1             Symfony Doctrine Bridge
symfony/dom-crawler          v4.1.0             v4.1.1             Symfony DomCrawler Component
symfony/dotenv               v4.1.0             v4.1.1             Registers environment variables from a .env file
symfony/event-dispatcher     v4.1.0             v4.1.1             Symfony EventDispatcher Component
symfony/expression-language  v4.1.0             v4.1.1             Symfony ExpressionLanguage Component
symfony/filesystem           v4.1.0             v4.1.1             Symfony Filesystem Component
symfony/finder               v4.1.0             v4.1.1             Symfony Finder Component
symfony/flex                 v1.0.80            v1.0.80           
symfony/form                 v4.1.0             v4.1.1             Symfony Form Component
symfony/framework-bundle     v4.1.0             v4.1.1             Symfony FrameworkBundle
symfony/http-foundation      v4.1.0             v4.1.1             Symfony HttpFoundation Component
symfony/http-kernel          v4.1.0             v4.1.1             Symfony HttpKernel Component
symfony/inflector            v4.1.0             v4.1.1             Symfony Inflector Component
symfony/intl                 v4.1.0             v4.1.1             A PHP replacement layer for the C intl extension that includes addi...
symfony/lts                  dev-master 6de50b2 dev-master 6de50b2 Enforces Long Term Supported versions of Symfony components
symfony/maker-bundle         v1.5.0             v1.5.0             Symfony Maker helps you create empty commands, controllers, form cl...
symfony/monolog-bridge       v4.1.0             v4.1.1             Symfony Monolog Bridge
symfony/monolog-bundle       v3.3.0             v3.3.0             Symfony MonologBundle
symfony/options-resolver     v4.1.0             v4.1.1             Symfony OptionsResolver Component
symfony/orm-pack             v1.0.5             v1.0.5             A pack for the Doctrine ORM
symfony/phpunit-bridge       v4.1.0             v4.1.1             Symfony PHPUnit Bridge
symfony/polyfill-ctype       v1.8.0             v1.8.0             Symfony polyfill for ctype functions
symfony/polyfill-intl-icu    v1.8.0             v1.8.0             Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-mbstring    v1.8.0             v1.8.0             Symfony polyfill for the Mbstring extension
symfony/polyfill-php72       v1.8.0             v1.8.0             Symfony polyfill backporting some PHP 7.2+ features to lower PHP ve...
symfony/process              v4.1.0             v4.1.1             Symfony Process Component
symfony/profiler-pack        v1.0.3             v1.0.3             A pack for the Symfony web profiler
symfony/property-access      v4.1.0             v4.1.1             Symfony PropertyAccess Component
symfony/property-info        v4.1.0             v4.1.1             Symfony Property Info Component
symfony/routing              v4.1.0             v4.1.1             Symfony Routing Component
symfony/security             v4.1.0             v4.1.1             Symfony Security Component
symfony/security-acl         v3.0.1             v3.0.1             Symfony Security Component - ACL (Access Control List)
symfony/security-bundle      v4.1.0             v4.1.1             Symfony SecurityBundle
symfony/serializer           v4.1.0             v4.1.1             Symfony Serializer Component
symfony/serializer-pack      v1.0.1             v1.0.1             A pack for the Symfony serializer
symfony/stopwatch            v4.1.0             v4.1.1             Symfony Stopwatch Component
symfony/swiftmailer-bundle   v3.2.2             v3.2.2             Symfony SwiftmailerBundle
symfony/templating           v4.1.0             v4.1.1             Symfony Templating Component
symfony/translation          v4.1.0             v4.1.1             Symfony Translation Component
symfony/twig-bridge          v4.1.0             v4.1.1             Symfony Twig Bridge
symfony/twig-bundle          v4.1.0             v4.1.1             Symfony TwigBundle
symfony/validator            v4.1.0             v4.1.1             Symfony Validator Component
symfony/var-dumper           v4.1.0             v4.1.1             Symfony mechanism for exploring and dumping PHP variables
symfony/web-link             v4.1.0             v4.1.1             Symfony WebLink Component
symfony/web-profiler-bundle  v4.1.0             v4.1.1             Symfony WebProfilerBundle
symfony/web-server-bundle    v4.1.0             v4.1.1             Symfony WebServerBundle
symfony/webpack-encore-pack  v1.0.2             v1.0.2             A pack for Symfony Encore
symfony/yaml                 v4.1.0             v4.1.1             Symfony Yaml Component
@filozofer
Copy link

Same here, is this package still up to date with the last MediaSonataBundle ?

@filozofer
Copy link

This bundle is currently obselete with last Symfony Core, SonataBundle and CKEditor version.
I see at least this issues:

  • The controller does not override the controller of SonataMediaBundle anymore
  • The twig templates declaration does not work anymore
  • The createAction method of the controller does not respect the signature of SonataMediaBundle anymore and throw 500 error
  • The uploadAction method does not return json response as expect by the last CKEditor version rather than html with some js inside

In the meantime, this module is simple, so you can implement the same system in your project. This is what I did:

  • Create a MediaAdminController class base on the controller in this module
  • Adapt signature of createAction method
  • Declare a Compiler Pass to override MediaAdminController from SonataMediaBundle
  • Change the return response of uploadMethod like CKEditor except it (see doc)
  • Place the twig templates in the templates folder of my project and change the name use in the browserAction method
  • Declare MediaAdminExtension like the module (this still work as expect)

@JonathanBaudoin
Copy link

Hi,

Any news about this issue ?

@filozofer If you solved this issue, is it possible to make a PR ? If not, can you add more details on what you did ?

@filozofer
Copy link

Hi,

@JonathanBaudoin No news from the mainteners.
Sorry, no time to create a real and tested PR but here's a gist I just create in order to help others in the mean time:
https://gist.github.com/filozofer/e397a83d44f552bfbcf7f1b325b284c6

Have a good day!

@dunglas
Copy link
Member

dunglas commented Nov 14, 2018

Hi, and sorry for the delay.
If someone would work on a PR (and fixing the tests...), it would be very appreciated. Unfortunately we'll not be able to it by ourself any time soon.

@memboc
Copy link

memboc commented Jan 15, 2019

Its not compatible with sonata 3.4 and symfony 4.2

This decision works for me:

#config/routes/sonata_media.yaml
#...
# browse & upload routes for CKEditor
admin_sonata_media_media_browser:
    path: /admin/sonata/media/media/browser
    controller: CoopTilleuls\Bundle\CKEditorSonataMediaBundle\Controller\MediaAdminController::browserAction
    defaults:
        _sonata_admin: sonata.media.admin.media

admin_sonata_media_media_upload:
    path: /admin/sonata/media/media/upload
    controller: CoopTilleuls\Bundle\CKEditorSonataMediaBundle\Controller\MediaAdminController::uploadAction
    defaults:
        _sonata_admin: sonata.media.admin.media
#config/packages/coop_tilleuls_ck_editor_sonata_media.yaml
#override template names for compatibility with symfony 4.2
coop_tilleuls_ck_editor_sonata_media:
    templates:
        browser: '@CoopTilleulsCKEditorSonataMedia/MediaAdmin/browser.html.twig'
        upload:  '@CoopTilleulsCKEditorSonataMedia/MediaAdmin/upload.html.twig'
        layout:  'sonata/coop_tilleuls_sonata_media/layout.html.twig'
{# templates/sonata/coop_tilleuls_sonata_media/layout.html.twig #}
{# adding  Sonata config, for compatibility with sonata 3.4 #}
{% extends '@CoopTilleulsCKEditorSonataMedia/layout.html.twig' %}

{% block meta_tags %}
    <meta charset="UTF-8">
    <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
    <meta data-sonata-admin='{{ {
        config: {
            CONFIRM_EXIT: sonata_admin.adminPool.getOption('confirm_exit'),
            USE_SELECT2: sonata_admin.adminPool.getOption('use_select2'),
            USE_ICHECK: sonata_admin.adminPool.getOption('use_icheck'),
            USE_STICKYFORMS: sonata_admin.adminPool.getOption('use_stickyforms'),
            DEBUG: sonata_admin.adminPool.getOption('js_debug'),
        },
        translations: {
            CONFIRM_EXIT: 'confirm_exit'|trans({}, 'SonataAdminBundle'),
        },
    }|json_encode()|raw }}'
    >
{% endblock %}

@roelleor
Copy link

Thanks so much @memboc , I noted that creating the custom layout didn't make any difference + one should install an older version of ckeditor for this bundle to work:
php bin/console ckeditor:install --tag=4.7.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants