Coder Social home page Coder Social logo

sonata-project / sonataformatterbundle Goto Github PK

View Code? Open in Web Editor NEW
80.0 19.0 117.0 3.48 MB

Symfony SonataFormatterBundle

Home Page: https://docs.sonata-project.org/projects/SonataFormatterBundle

License: MIT License

PHP 93.69% Makefile 1.87% Twig 4.45%
bundle formatter php sonata symfony symfony-bundle ckeditor editor

sonataformatterbundle's Introduction

SonataFormatterBundle

Symfony SonataFormatterBundle

Latest Stable Version Latest Unstable Version Psalm Type Coverage License

Total Downloads Monthly Downloads Daily Downloads

Branch Github Actions Code Coverage Documentation
5.x Test Coverage Status Documentation Status
6.x Test Coverage Status Documentation Status

Documentation

Check out the documentation on the official website.

Support

For general support and questions, please use StackOverflow.

If you think you found a bug or you have a feature idea to propose, feel free to open an issue after looking at the contributing guide.

License

This package is available under the MIT license.

sonataformatterbundle's People

Contributors

alexkvak avatar bladrak avatar core23 avatar covex-nn avatar djacedj avatar dmarkowicz avatar franmomu avatar greg0ire avatar hason avatar hug963 avatar hvanoch avatar jordisala1991 avatar jorrit avatar kunicmarko20 avatar oskarstark avatar pborreli avatar petk avatar phansys avatar pomaxa avatar pulzarraider avatar rande avatar ronanguilloux avatar sagikazarmark avatar sonataci avatar soullivaneuh avatar th3mouk avatar tomadam avatar venis avatar vincentlanglet avatar wbloszyk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sonataformatterbundle's Issues

Could not load type "textarea"

$ composer show sonata-project/*
sonata-project/admin-bundle              3.4.0              The missing Symfony Admin Generator
sonata-project/block-bundle              3.1.1              Symfony SonataBlockBundle
sonata-project/cache                     1.0.7              Cache library
sonata-project/classification-bundle     3.1.0              Symfony SonataClassificationBundle
sonata-project/core-bundle               3.0.3              Symfony SonataCoreBundle
sonata-project/datagrid-bundle           2.2                Symfony SonataDatagridBundle
sonata-project/doctrine-extensions       1.0.2              Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.0.5              Symfony Sonata / Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/easy-extends-bundle       2.1.10             Symfony SonataEasyExtendsBundle
sonata-project/exporter                  1.6.0              Lightweight Exporter library
sonata-project/formatter-bundle          dev-master c3a7745 Symfony SonataFormatterBundle
sonata-project/intl-bundle               2.2.4              Symfony SonataIntlBundle
sonata-project/media-bundle              3.1.0              Symfony SonataMediaBundle
sonata-project/notification-bundle       3.0.0              Symfony SonataNotificationBundle

Symfony packages

$ composer show symfony/*
symfony/assetic-bundle     v2.8.0  Integrates Assetic into Symfony2
symfony/monolog-bundle     2.11.1  Symfony MonologBundle
symfony/phpunit-bridge     v3.1.3  Symfony PHPUnit Bridge
symfony/polyfill-apcu      v1.2.0  Symfony polyfill backporting apcu_* functions to lower PHP versions
symfony/polyfill-intl-icu  v1.2.0  Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-mbstring  v1.2.0  Symfony polyfill for the Mbstring extension
symfony/polyfill-php56     v1.2.0  Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions
symfony/polyfill-php70     v1.2.0  Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions
symfony/polyfill-util      v1.2.0  Symfony utilities for portability of PHP codes
symfony/security-acl       v3.0.0  Symfony Security Component - ACL (Access Control List)
symfony/swiftmailer-bundle v2.3.11 Symfony SwiftmailerBundle
symfony/symfony            v3.1.3  The Symfony PHP framework

PHP version

$ php -v
PHP 5.5.36 (cli) (built: May 29 2016 01:07:06)

In my formType i have:

        $builder->add('content');
        $builder->add('contentFormatter', SimpleFormatterType::class, array(
        'source_field' => 'content',
        'target_field' => 'contentF'
        ));

I have the error "Could not load type "textarea". Any ideas ?

Could not load type "textarea"


in vendor/symfony/symfony/src/Symfony/Component/Form/FormRegistry.php at line 87   -
                if (class_exists($name) && in_array('Symfony\Component\Form\FormTypeInterface', class_implements($name))) {
                    $type = new $name();
                } else {
                    throw new InvalidArgumentException(sprintf('Could not load type "%s"', $name));
                }
            }

Markitup js does not work entirely

I tried following the doc ยง about sonata admin integration, but icons wouldn't show up on top of the editor, and I would get an error about markitup looking for the deprecated jQuery.browser property.

Using the markitup version from the formatter bundle solves the problem, should I make a PR for that ?

My workaround :

-<script src="{{ asset('bundles/sonatamarkitup/markitup/markitup/jquery.markitup.js') }}" type="text/javascript"></script>
+<script src="{{ asset('bundles/sonataformatter/vendor/markitup-markitup/markitup/jquery.markitup.js') }}" type="text/javascript"></script>

compatibility with symfony 2.3

Currently this bundle requires <2.3 for symfony/symfony. Options are to either up this to <2.4, or to <3.0 and say the bundle will support all subsequent Symfony 2.x releases (which shouldn't be a stretch). Which should the bundle go for? Can submit a PR.

Size after upload 3.0

Hello,

When I upload a file using sonata formatter in sonata media, by default it will give me the original size (and sometime it's quite big).

It would be nice if we could choose which format we want to put instead :)

Update docs

I'm trying to use 'sonata_formatter_type' with sonata admin without success. The docs maybe are missing some step. I want to use ckeditor.

So in AppKernel I think is all right:

new Sonata\FormatterBundle\SonataFormatterBundle(),
new Ivory\CKEditorBundle\IvoryCKEditorBundle(),

In config:

ivory_ck_editor:
    default_config: my_config
    configs:
        my_config:
            language:  '%locale%'
            toolbar:   [ [ "Bold", "Italic", "Underline", "FontSize", 'TextColor'], [  "NumberedList",'BulletedList', 'JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], [ 'Outdent','Indent' ], [ 'Link','Unlink','Anchor' ], [ 'Cut','Copy','Paste','-','Undo','Redo'] ]

sonata_formatter:
    formatters:
        markdown:
            service: sonata.formatter.text.markdown
            extensions:
                - sonata.formatter.twig.control_flow
                - sonata.formatter.twig.gist
        text:
            service: sonata.formatter.text.text
            extensions:
                - sonata.formatter.twig.control_flow
                - sonata.formatter.twig.gist
        rawhtml:
            service: sonata.formatter.text.raw
            extensions:
                - sonata.formatter.twig.control_flow
                - sonata.formatter.twig.gist
        richhtml:
            service: sonata.formatter.text.raw
            extensions:
                - sonata.formatter.twig.control_flow
                - sonata.formatter.twig.gist

twig:
    form:
        resources:
            - 'SonataFormatterBundle:Form:formatter.html.twig'

in my admin class:

                ->add('myfield', 'sonata_formatter_type', array(
                    'event_dispatcher' => $formMapper->getFormBuilder()->getEventDispatcher(),
                    'format_field'   => 'myfield',
                    'source_field'   => 'myfield',
                    'ckeditor_context' => 'my_config',
                    'source_field_options'      => array(
                        'attr' => array('class' => 'span10', 'rows' => 7)
                    ),
                    'listener'       => true,
                    'target_field'   => 'myfield'
                ))

The result: a simple textarea with the script from formartter.html.twig

<div id="sonata-ba-field-container-s54084950b132f_myfield" class="form-group">
    <label class="control-label required">
        myfield
    </label>
    <div class=" sonata-ba-field sonata-ba-field-standard-natural  ">
        <div style="margin-bottom: 5px;">
            <textarea rows="7" class="span10 form-control" required="required" name="s54084950b132f[myfield][myfield]" id="s54084950b132f_myfield_myfield"></textarea>
        </div>

        <script>
            var s54084950b132f_myfield_rich_instance = false;

            jQuery(document).ready(function() {

                // This code requires CKEDITOR and jQuery MarkItUp
                if (typeof CKEDITOR === 'undefined' || jQuery().markItUp == undefined) {
                    return;
                }

                jQuery('#s54084950b132f_myfield_myfield').parents("form").on('click', function(event) {
                    if (s54084950b132f_myfield_rich_instance) {
                        s54084950b132f_myfield_rich_instance.updateElement();
                    }
                });

                jQuery('#s54084950b132f_myfield_myfield').change(function(event) {
                    var elms = jQuery('#s54084950b132f_myfield_myfield');
                    elms.markItUpRemove();
                    if (s54084950b132f_myfield_rich_instance) {
                        s54084950b132f_myfield_rich_instance.destroy();
                    }

                    var val = jQuery(this).val();
                    var appendClass = val;
                    switch (val) {
                        case 'textile':
                            elms.markItUp(markitup_sonataTextileSettings);
                            break;
                        case 'markdown':
                            elms.markItUp(markitup_sonataMarkdownSettings);
                            break;
                        case 'bbcode':
                            elms.markItUp(markitup_sonataBBCodeSettings);
                            break;
                        case 'rawhtml':
                            elms.markItUp(markitup_sonataHtmlSettings);
                            appendClass = 'html';
                            break;
                        case 'richhtml':
                            s54084950b132f_myfield_rich_instance = CKEDITOR.replace("s54084950b132f_myfield_myfield", {"toolbar": [["Bold", "Italic", "Underline", "FontSize", "TextColor"], ["NumberedList", "BulletedList", "JustifyLeft", "JustifyCenter", "JustifyRight", "JustifyBlock"], ["Outdent", "Indent"], ["Link", "Unlink", "Anchor"], ["Cut", "Copy", "Paste", "-", "Undo", "Redo"]], "language": "pt_BR"});
                            ;

                    }

                    var parent = elms.parents('div.markItUp');

                    if (parent) {
                        for (name in ['textile', 'markdown', 'bbcode', 'rawhtml', 'richhtml', 'rawhtml']) {
                            parent.removeClass(name)
                        }

                        parent.addClass(appendClass);
                    }
                });

                jQuery('#s54084950b132f_myfield_myfield').trigger('change');
            });
        </script>


    </div>
</div>

Am I missing something? Add some JS, CSS,...

After update problem with FormatterType and ckeditor_basepath type's option

Hi,

Can't figure out what's going wrong. Searched the docs and traced the code.

After update (composer.lock):

  • FormatterBundle: dev-master
  • Ivory/CKEditorBundle: 2.2.1

Error:

Notice: Undefined index: ckeditor_basepath in ..../vendor/sonata-project/formatter-bundle/Form/Type/FormatterType.php on line 129

Searching the code couldn't find the file where the type's $options['ckeditor_basepath'] is actually being set.

Any idea?

Uncaught TypeError: Cannot read property 'destroy' of undefined

Hy,

I've got an error (please see on the subject), when I switch between formatters.
But this error occurs after some change, not at first, or second. I don't find the logic behind the error.

Could you please take a look at the problem. I can show you my config file(s) if it necessary.

Best regards,
Norbert

Fatal error: Declaration of Sonata\FormatterBundle\Form\Type\FormatterType::getDefaultOptions()

I get the error:

Fatal error: Declaration of Sonata\FormatterBundle\Form\Type\FormatterType::getDefaultOptions() must be compatible with that of Symfony\Component\Form\FormTypeInterface::getDefaultOptions() in C:\xampp\htdocs\site\vendor\bundles\Sonata\FormatterBundle\Form\Type\FormatterType.php on line 24

This seems to be correct

FormatterType

    public function getDefaultOptions();

FormTypeInterface

   function getDefaultOptions(array $options);

Unknown "ckeditor_widget" function

Unknown "ckeditor_widget" function. Did you mean "ckeditor_plugin" in SonataFormatterBundle:Form:formatter.html.twig at line 58

sonata-project/formatter-bundle dev-master a665525
egeloen/ckeditor-bundle 2.5.2

Adding format_field_options to sonata_formatter_type causes error

When I try to add the format_field_options, I get the following error:

Key "choices" for array with keys "attr" does not exist in SonataFormatterBundle:Form:formatter.html.twig at line 5

Here's my code in the admin

     'format_field_options' => array(
        'attr' => array('class' =>'test')
    ),

By looking up really quick, it seems that when we pass the 'format_field_options', it overwrites the existing array instead of merging. I'll look further into it.

knp-markdown-bundle update

when using assets install I get a message telling dflydev/markdown is abandoned.
Any objection in upping knp-markdown-bundle version which uses michelf/php-markdown ?

FormatterBlockService override Value

Hi,

I'm using FormatterBlock the first time but every time I save/update/open the content will be overridden by the default value "Insert your custom content here" within the editor.

Can you check if this is not only a local problem to me? Would help to fix this then.

Marc

Unfortunately does not work with Symfony 3.0.1

On master branch, in composer you stated:

"symfony/form": "~2.3|~3.0",

but this requires: "symfony/options-resolver: ~2.8|~3.0" and unfortunately for your code, OptionsResolverInterface has been removed, while you still use it in following form:

https://github.com/sonata-project/SonataFormatterBundle/blob/master/Form/Type/SimpleFormatterType.php#L60

In order to make it working I had to:

  1. Change
    use Symfony\Component\OptionsResolver\OptionsResolverInterface
    to
    use Symfony\Component\OptionsResolver\OptionsResolver;

  2. Change
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    to
    public function configureOptions(OptionsResolver $resolver)

I'm almost sure that another form, FormatterType may be affected by similar issue.

P.S: If you want, I can create PR to fix it, cause I really need it for my project :)

ServiceNotFoundException: The service "sonata.formatter.twig.env.markdown" has a dependency on a non-existent service "sonata.media.formatter.twig"

Hello ,
I'm trying to integrate the Formatter bundle with my sonata admin backend but i get this error:

ServiceNotFoundException: The service "sonata.formatter.twig.env.markdown" has a dependency on a non-existent service "sonata.media.formatter.twig"

so can you help me to fix this

thanks

fixed by removing this line from the config ๐Ÿ‘

            - sonata.media.formatter.twig

but i get a white screen and i cant see why ?

Documentation sucks

Please, write some doc, explain the config.

We don't care about copy pasting examples, we need some docs.

Latest 2.3.*@dev and egeloen/ckeditor-bundle problem

Seems there is a problem with the "egeloen/ckeditor-bundle" and "sonata-project/formatter-bundle": "2.3.*@dev"

Fatal error: Uncaught exception 'Symfony\Component\DependencyInjection\Exception\ScopeWideningInjectionException' with message 'Scope Widening Injection detected: The definition "sonata.formatter.form.type.selector" references the service "ivory_ck_editor.config_manager" which belongs to a narrower scope. Generally, it is safer to either move "sonata.formatter.form.type.selector" to scope "request" or alternatively rely on the provider pattern by injecting the container itself, and requesting the service "ivory_ck_editor.config_manager" each time it is needed.

They made some changes to the services scope in 2.2.1
egeloen/IvoryCKEditorBundle#86
but I tried using 2.2.0 and got the same problem.

Dependency on MediaAdminController in CkeditorAdminController.php

Hi there, I just included the SonataFormatterBundle in one of our projects and I noticed that there is a hard dependency on the SonataMediaBundle. Is there any way around this by changing the configuration?

When clearing the Symfony cache I receive the following exception:
PHP Fatal error: Class 'Sonata\MediaBundle\Controller\MediaAdminController' not found in /var/www/vendor/sonata-project/formatter-bundle/Controller/CkeditorAdminController.php on line 21

Syntax error

SonataFormatterExtension::createEnvironment()

line 60 typo error: calls createEnvironement()

"sonata-project/formatter-bundle": "2.3.*@dev",

Could not load type "sonata_simple_formatter_type"

Hi there,
I'm running Symfony CMF with Sonata admin. Following these installation instructions and using field type sonata_simple_formatter_type results in the error:
Could not load type "sonata_simple_formatter_type"

The issue is that installation using composer require sonata-project/formatter-bundle retrieves the latest version, ^2.3. That version though, does not have the custom field type,sonata_simple_formatter_type. The field type is on the master branch

To resolve this, the field type could be added to a new release, 2.3.x so that all installations going forward don't run into this.
In the interim though, those running into the issue can require @dev-master

always "Insert your custom content here" as content in formatter Block front end

Hi everybody
I added a Sonata Formatter Block in my page on my Sonata sandbox version and even editing with success (on DB too) the content (registered with CKEditor in richhtml format) I've always the same default phrase "Insert your custom content here" on front end..

here some pictures :
capture decran 2014-01-20 a 13 32 15
capture decran 2014-01-20 a 13 33 24

should I miss something or nobody use formatter block.... :)
Thanx in advance

Default formatter

As I said in my comment on commit 9a7057e, I do not see anything in the documentation of what we have to write in default_formatter configuration.

Thanks for your reactivity ๐Ÿ˜‰

using the simple formatter widget in block does not save content using block in sonata page bundle

Hi there,

I have a project using the sonata admin and page bundle. I've created a custom block defining a field as "sonata_simple_formatter_type". Rendering of the CKEditor is working flawless, but it does not save the correct content when I try to create or update the block in the pages composer mode (e.g. http:/example.com/app_dev.php/admin/sonata/page/page/48/compose)

When I access the the block directly via the crud admin form (e.g. http:/example.com/app_dev.php/admin/sonata/page/block/440/edit?composer=1) there is no problem at all and I can update and create the content as needed.

I was able to debug the php side, so I know that the request in the latter case does not contain the updates made in the ckeditor for this form field.

Remove inline scripts

For many reasons, we should remove all scripts from the templates. We could replace them with data listerns like in the page bundle: sonata-project/SonataPageBundle#562.

General

Inline scripts couldn't be cached and would pollute the html output.

Security

There is also a security bundle which introduces some interesting information about security. You could completly disable inline script via a http header to reduce possible XSS attacks.

For more information: http://www.w3.org/TR/CSP/

Todo

The following files contains inline scripts and should be removed in the next major release, because this is a BC break.

Compatible to SonataAdmin 3.x

Is there any timeline or checklist to make this bundle ready to use together with SonataAdminBundle 3.x? I tried to install the 2.4.x which would work with sf3 but still relies on older block and core bundle.

Media context does not work with CKEditor

Environment

Sonata packages

$ composer show sonata-project/*
sonata-project/admin-bundle              3.x-dev 4cc8449    The missing Symfony Admin Generator
sonata-project/block-bundle              3.x-dev 565d0a7    Symfony SonataBlockBundle
sonata-project/cache                     1.0.7              Cache library
sonata-project/classification-bundle     dev-master b89d2f8 Symfony SonataClassificationBundle
sonata-project/core-bundle               3.x-dev 8e1cdbd    Symfony SonataCoreBundle
sonata-project/datagrid-bundle           2.2                Symfony SonataDatagridBundle
sonata-project/doctrine-extensions       1.0.2              Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.x-dev e974094    Symfony Sonata / Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/easy-extends-bundle       2.1.10             Symfony SonataEasyExtendsBundle
sonata-project/exporter                  1.4.1              Lightweight Exporter library
sonata-project/formatter-bundle          3.x-dev 1f4d7f3    Symfony SonataFormatterBundle
sonata-project/google-authenticator      1.0.2              Library to integrate Google Authenticator into a PHP project
sonata-project/intl-bundle               2.2.4              Symfony SonataIntlBundle
sonata-project/media-bundle              3.x-dev 61027c5    Symfony SonataMediaBundle
sonata-project/notification-bundle       3.0.0              Symfony SonataNotificationBundle
sonata-project/user-bundle               3.x-dev 33fada8    Symfony SonataUserBundle

Symfony packages

$ composer show symfony/*
symfony/assetic-bundle     v2.8.0  Integrates Assetic into Symfony2
symfony/monolog-bundle     2.11.1  Symfony MonologBundle
symfony/polyfill-apcu      v1.2.0  Symfony polyfill backporting apcu_* functions to lower PHP versions
symfony/polyfill-intl-icu  v1.2.0  Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-mbstring  v1.2.0  Symfony polyfill for the Mbstring extension
symfony/polyfill-php54     v1.2.0  Symfony polyfill backporting some PHP 5.4+ features to lower PHP versions
symfony/polyfill-php55     v1.2.0  Symfony polyfill backporting some PHP 5.5+ features to lower PHP versions
symfony/polyfill-php56     v1.2.0  Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions
symfony/polyfill-php70     v1.2.0  Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions
symfony/polyfill-util      v1.2.0  Symfony utilities for portability of PHP codes
symfony/security-acl       v3.0.0  Symfony Security Component - ACL (Access Control List)
symfony/swiftmailer-bundle v2.3.11 Symfony SwiftmailerBundle
symfony/symfony            v2.8.7  The Symfony PHP framework

PHP version

$ php -v
PHP 5.6.22-1+donate.sury.org~trusty+1 (cli) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
    with Xdebug v2.3.3, Copyright (c) 2002-2015, by Derick Rethans

Subject

Hi,

I use a CKEditor type in a textarea in the configureFormFields(). It works, except the image browser.

When I want to add an image in my textarea, a modal opens, with a button to browse my images. I can see images from default context (which is defined in the ivory_ck_editor config as default context), but not images from an other context. It's because in the URL, the category param is always set to the default context category, even when I choose an other context. I specify that all my images have categories.

I try to edit SonataFormatterBundle/Controller/CkeditorAdminController:browserAction at line 60:

<?php
# SonataFormatterBundle/Controller/CkeditorAdminController

# After:
if ($this->getRequest()->get('category'))

# Now:
if ($this->getRequest()->get('category') && count($datagrid->getResults()) == 0)

And it works, I can see my images when I change context. But I can't use this solution in a long time.
I saw this issue, which seems to be the same, but it seems to be unresolved yet.

Sonata Block Bundle requirement

The SonataFormatterExtension explicitly loads Resources/config/block.xml which requires the Sonata BlockBundle to be installed. But the BlockBundle is not a dependency of the FormatterBundle.

Please make it load the block.xml only if the BlockBundle is activated. If that is impossible, then make the BlockBundle a hard requirement of this bundle.

Add custom parser

Hi,
I'm trying to add a custom parser for the bbcode.
I created the formatter test:

<?php
namespace Equiweb\CommonBundle\Formatter;

use Sonata\FormatterBundle\Formatter\BaseFormatter;

class BbcodeFormatter extends BaseFormatter
{
    /**
     * @param $text
     * @return string
     */
    public function transform($text)
    {
        return $text . 'test';
    }
}

I added the service

  equiweb.formatter.bbcode:
    class : Equiweb\CommonBundle\Formatter\BbcodeFormatter
    tags : 
      - {name : sonata.text.formatter} 

and finally

#config.yml
sonata_formatter:
    formatters:
#...
        bbcode:
            service: equiweb.formatter.bbcode
            extensions:
                - sonata.formatter.twig.control_flow
                - sonata.formatter.twig.gist
                - sonata.media.formatter.twig

The problem is that the service is not found:

The service definition "equiweb.formatter.bbcode" does not exist.

If I edit the file formatter.xml within SonataFormatterBundle adding the definition of the service, then it works.

#formatter.xml

        <service id="sonata.formatter.text.bbcode" class="Equiweb\Common\CommonBundle\Formatter\BbcodeFormatter">
            <tag name="sonata.text.formatter"/>

        </service>

How can I solve?

thankyou!

fatal erreur with buidForm

I get the error:

Fatal error: Declaration of Sonata\FormatterBundle\Form\Type\FormatterType::buildForm() must be compatible with that of Symfony\Component\Form\FormTypeInterface::buildForm() in /media/stock/site_web/euradio/vendor/bundles/Sonata/FormatterBundle/Form/Type/FormatterType.php

Widget broken with PR #205

Subject

This PR #205 broke the main widget in the page composer.

The simple widget is not affected as it was not updated.

I get this error in the admin:

The option "choice_translation_domain" does not exist. Defined options are: "action", "allow_extra_fields", "attr", "auto_initialize", "block_name", "by_reference", "cascade_validation", "compound", "constraints", "csrf_field_name", "csrf_message", "csrf_protection", "csrf_provider", "csrf_token_id", "csrf_token_manager", "data", "data_class", "disabled", "empty_data", "error_bubbling", "error_mapping", "extra_fields_message", "horizontal_input_wrapper_class", "horizontal_label_class", "horizontal_label_offset_class", "inherit_data", "intention", "invalid_message", "invalid_message_parameters", "label", "label_attr", "label_format", "label_render", "mapped", "max_length", "method", "pattern", "post_max_size_message", "property_path", "read_only", "required", "sonata_admin", "sonata_field_description", "sonata_help", "static_control", "translation_domain", "trim", "validation_groups", "virtual".

Rich Text CkEditor Context

I am not sure if this is a Formatter bug or a Sonata-Sandbox bug.

Anyhow, the default context is not being set, the ckeditor_context stays null.
The only way i can figure out of changing the ckeditor_context is to edit the SonataFormatterBundle/Form/Type/FormatterType.php:175, obviously not ideal!

As I said this might be because the SandBox is not setting this correctly(if not how do I?) or maybe the Formatter bundle is not using ivory_ck_editor->default_config (maybe ts not meant to).

Sorry for the not so concise report...

ClassNotFoundException: Attempted to load class "Formatter"

Hi guys,

I'm trying create a new post (newsBundle) and throw this:

ClassNotFoundException: Attempted to load class "Formatter" from namespace "Symfony\Component\Validator\Constraints\Sonata\FormatterBundle\Validator\Constraints" in /xxxxx/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Loader/AbstractLoader.php line 64. Do you need to "use" it from another namespace?

Could you help me?

Thanks

CKEditor custom plugins are not being loaded

Sonata packages

SonataFormatterBundle 3.x-dev (3.0.1)

name     : sonata-project/formatter-bundle
descrip. : Symfony SonataFormatterBundle
keywords : CKEditor, formatter, markdown, markitup, sonata
versions : * 3.x-dev

Subject

CKEditor custom plugins are not being loaded in the admin panel during rendering Formatter Block in Pages. I guess this happens because PluginManager is not being passed to the FormatterType constructor.

Steps to reproduce

Try to use SonataFormatterBundle with SonataPageBundle and render sonata.formatter.block.formatter in the Composer (in the SonataPage context, not the package manager).

Quick fix

I came up with a quick fix that requires modification of 3 files. I don't know if it is the best solution, but worked for me:

sonata-project/formatter-bundle/Resources/config/form.xml after line 8
Pass the PluginManager to the sonata.formatter.form.type.selector service:

[...]
    <argument type="service" id="ivory_ck_editor.config_manager"/>
    <argument type="service" id="ivory_ck_editor.plugin_manager"/>
[...]

sonata-project/formatter-bundle/Resources/views/Form/formatter.html.twig after line 55
Render plugins in the view:

[...]
case 'richhtml':
    {% for plugin_name, plugin in ckeditor_plugins %}
        {{ ckeditor_plugin(plugin_name, plugin) }}
    {% endfor %}
[...]

sonata-project/formatter-bundle/Form/Type/FormatterType.php
Add the PluginManagerInterface to the constructor arguments and pass plugins to the view.

[...]
    /**
     * @var PluginManagerInterface
     */
    protected $pluginManager;

[...]
    /**
     * Constructor.
     *
     * @param Pool $pool A Formatter Pool service
     * @param TranslatorInterface $translator A Symfony Translator service
     * @param ConfigManagerInterface $configManager An Ivory CKEditor bundle configuration manager
     * @param PluginManagerInterface $pluginManager
     */
    public function __construct(Pool $pool, TranslatorInterface $translator, ConfigManagerInterface $configManager, PluginManagerInterface $pluginManager)
    {
        $this->pool = $pool;
        $this->translator = $translator;
        $this->configManager = $configManager;
        $this->pluginManager = $pluginManager;
    }
[...]
        // buildView() method:
        $view->vars['ckeditor_plugins'] = $this->pluginManager->getPlugins();
[...]

knp-markdown requirement

Hello,

I wanted to make a fresh install of my vendors, but sonata-formatter requires knp-mardown from version 1.1.* while sonata-news requires dev-master.
As composer can't install two versions, the install fails. Can you choose wether your bundles need 1.1.* or dev-master ?

Updated formatter block does not work

Editing of a newly created block fails with
"Catchable Fatal Error: Argument 3 passed to Symfony\Component\Form\FormBuilder::add() must be of the type array, object given [..]"

Seems like the culprit is

"at FormBuilder ->add ('content', 'sonata_formatter_type', object(Closure)) "

Circular reference error when using "sonata.formatter.text.twigengine" in prod mode

When using the "sonata.formatter.text.twigengine" formatter in production mode we receive the following error:

request.CRITICAL: Uncaught PHP Exception Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException: "Circular reference detected for service "sonata.formatter.pool", path: "sonata.formatter.form.type.selector -> sonata.formatter.pool -> sonata.formatter.text.twigengine -> twig"." at /var/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php line 301 {"exception":"[object](Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException%28code: 0%29: Circular reference detected for service "sonata.formatter.pool", path: "sonata.formatter.form.type.selector -> sonata.formatter.pool -> sonata.formatter.text.twigengine -> twig". at /var/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:301)"} []

Is anyone experiencing the same problem in production? We are using Symfony v2.3.24

FatalErrorException in FormatterBlockService.php line 86:

Hi,

After update my composer.json i got this error:

FatalErrorException in FormatterBlockService.php line 86: Compile Error: Declaration of Sonata\FormatterBundle\Block\FormatterBlockService::validateBlock() must be compatible with Sonata\BlockBundle\Block\BlockAdminServiceInterface::validateBlock(Sonata\CoreBundle\Validator\ErrorElement $errorElement, Sonata\BlockBundle\Model\BlockInterface $block)

How can i fix it ?

This is my composer:

        "sonata-project/formatter-bundle": "2.x-dev",
        "egeloen/ckeditor-bundle": "2.3.0",
        "sonata-project/user-bundle": "3.x-dev",
        "sonata-project/page-bundle": "dev-master",
        "sonata-project/core-bundle": "3.x-dev as 2.4",
        "sonata-project/admin-bundle": "3.x-dev as 2.4",
        "sonata-project/doctrine-orm-admin-bundle": "3.x-dev as 2.4",
        "sonata-project/block-bundle": "3.x-dev as 2.4",
        "sonata-project/datagrid-bundle": "2.2.*@dev",
        "sonata-project/easy-extends-bundle": "~2.1",
        "sonata-project/seo-bundle":  "2.0.*@dev",
        "sonata-project/cache-bundle": "2.1.*",
        "sonata-project/comment-bundle": "~2.2@dev",
        "sonata-project/notification-bundle":  "2.3.*@dev",

Unknown "ckeditor_widget" function

After update all my bundle with composer i'm have this error:

Unknown "ckeditor_widget" function. Did you mean "ckeditor_plugin" in "SonataFormatterBundle:Form:formatter.html.twig" at line 58?

i think there is a problem with SonataFormatterBundle

this is my composer.json

"require": { "php": ">=5.3.9", "symfony/symfony": "2.8.*", "egeloen/ckeditor-bundle": "~2.2", "sonata-project/formatter-bundle": "dev-master", "sonata-project/page-bundle": "dev-master"

This is the line 58 in "SonataFormatterBundle:Form:formatter.html.twig" :

```{{ source_id }}_rich_instance = {{
                        ckeditor_widget(form.children[source_field].vars.id, ckeditor_configuration)
                    }};```

Any idea how how to fix this issue ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.