Git Product home page Git Product logo

block-bundle's Introduction

This repository is no longer maintained

Due to lack of interest, we had to decide to discontinue this repository. The CMF project focusses on the Routing component and RoutingBundle, which are still in active use by other projects.

This repository will no longer be upgraded and marked as abandoned, but will be kept available for legacy projects or if somebody wants to experiment with the CMF.

You can contact us in the #symfony_cmf channel of the Symfony devs slack.

Symfony CMF Block Bundle

Latest Stable Version Latest Unstable Version License

Total Downloads Monthly Downloads Daily Downloads

Branch Travis Coveralls Scrutinizer
2.x Build Status Coverage Status Scrutinizer Status
master Build Status Coverage Status Scrutinizer Status

This package is part of the Symfony Content Management Framework (CMF) and licensed under the MIT License.

The BlockBundle provides integration with SonataBlockBundle. It is used to manage fragments of content, so-called blocks, that are persisted in a database and can be incorporated into any page layout. The BlockBundle also provides a few commonly used standard blocks, including the ability to edit them.

Requirements

  • PHP 7.1 / 7.2
  • Symfony 2.8 / 3.3 / 3.4 / 4.0
  • See also the require section of composer.json

Documentation

For the install guide and reference, see:

See also:

Support

For general support and questions, please use StackOverflow.

Contributing

Pull requests are welcome. Please see our CONTRIBUTING guide.

Unit and/or functional tests exist for this package. See the Testing documentation for a guide to running the tests.

Thanks to everyone who has contributed already.

License

This package is available under the MIT license.

block-bundle's People

Contributors

brki avatar chrootlogin avatar cordoval avatar dantleech avatar dbu avatar electricmaxxx avatar emmanuelvella avatar jakuza avatar kingcrunch avatar krizon avatar lsmith77 avatar metalvarez avatar nacmartin avatar nvbooster avatar pamil avatar petesiss avatar petk avatar phiamo avatar pulzarraider avatar rndstr avatar sebastianblum avatar seldaek avatar shieldo avatar simensen avatar uwej711 avatar vcraescu avatar wcluijt avatar wouterj avatar xabbuh avatar xleliberty avatar

Stargazers

 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

block-bundle's Issues

ParameterNotFoundException: The service "symfony_cmf_block.simple_admin" has a dependency on a non-existent parameter "symfony_cmf_content.content_basepath".

HI,
Everything was working fine before update. To install JMSPaymentCoreBundle, I just run php composer.phar update command. After that I got below error.

ParameterNotFoundException: The service "symfony_cmf_block.simple_admin" has a dependency on a non-existent parameter "symfony_cmf_content.content_basepath".

While update:

 - Removing symfony/symfony (v2.1.4)
  - Installing symfony/symfony (v2.1.6)
    Downloading: 100%         

  - Removing symfony/swiftmailer-bundle (v2.1.0)
  - Installing symfony/swiftmailer-bundle (v2.1.5)
    Downloading: 100%         

  - Removing symfony/monolog-bundle (v2.1.0)
  - Installing symfony/monolog-bundle (v2.1.5)
    Downloading: 100%         

  - Removing sensio/distribution-bundle (v2.1.4)
  - Installing sensio/distribution-bundle (v2.1.5)
    Downloading: 100%         

  - Removing sensio/framework-extra-bundle (v2.1.4)
  - Installing sensio/framework-extra-bundle (v2.1.5)
    Downloading: 100%         

  - Removing sensio/generator-bundle (v2.1.4)
  - Installing sensio/generator-bundle (v2.1.5)
    Downloading: 100%         

  - Removing friendsofsymfony/user-bundle (v1.3.0)
  - Installing friendsofsymfony/user-bundle (v1.3.1)
    Downloading: 100%         

  - Installing jms/payment-core-bundle (dev-master 6f71468)
    Cloning 6f714685f2520a2c57f910f4589328ddb3a34f2c

  - Updating symfony-cmf/core-bundle dev-master (93b54c5 => 08a153b)
    Checking out 08a153b3245f653881d81eb0d2a439314828cd98

  - Updating symfony-cmf/content-bundle dev-master (187d968 => 60b7193)
    Checking out 60b719359903b7f3cbe5fba6d54be815104c4ba0

  - Updating symfony-cmf/menu-bundle dev-master (547c5fc => 4d8a1b8)
    Checking out 4d8a1b871194739e15bdb9f591957b82127ecfae

  - Updating sonata-project/block-bundle dev-master (60b12fd => 92b2bfd)
    Checking out 92b2bfd445bc83a0fa7149ef760fa0d0f2587845

  - Updating symfony-cmf/block-bundle dev-master (f3d5ffe => 423e624)
    Checking out 423e6246f6489e42607c816c6d924de937e8a599

  - Updating friendsofsymfony/jsrouting-bundle dev-master (f72dc53 => 49449cd)
    Checking out 49449cd5ecde0254fdc554068fe8c87470b1057d

  - Updating symfony-cmf/tree-browser-bundle dev-master (a489099 => 2e3ed42)
    Checking out 2e3ed42be270463dd10b9909043a128fda0f0a49

  - Updating symfony-cmf/symfony-cmf dev-master (09b8fba => 424e81a)
    Checking out 424e81a41567fad95e38d0560154b36ce39a3c02

  - Updating jms/di-extra-bundle dev-master (d9a18c6 => aff6f3d)
    Checking out aff6f3da3c866ef06d13e7c9043e1253f11932a0

  - Updating phpcollection/phpcollection dev-master (0.10.0 => 360a888)
    Checking out 360a888f246773e660fce0d175cf62e41f50dd22

  - Updating jms/serializer dev-master (160cad9 => 00d1055)
    Checking out 00d10555138e2ae7a807b83b802605983f255000

  - Updating friendsofsymfony/rest-bundle dev-master (d1b3fcf => 9991dbc)
    Checking out 9991dbc36d16dcf5bf79f0c2decc2435d753008e

  - Updating midgard/createphp dev-master (db19f76 => 1e4be01)
    Checking out 1e4be013e94915304d17401fb0c85e924e8799de

  - Updating sonata-project/admin-bundle dev-master (4dab673 => 9b470e2)
    Checking out 9b470e2782b72377565af912274fbc4601847a8c

  - Updating sonata-project/doctrine-phpcr-admin-bundle dev-master (99fa387 => b6da786)
    Checking out b6da7860c0dd0f7bec9ba5ba3b2a0408bcd7766c

  - Updating sonata-project/cache-bundle dev-master (d4060e0 => 2d8e5f6)
    Checking out 2d8e5f615bcfa3679f7e438c3250fcb1f82e5281

  - Updating jackalope/jackalope-doctrine-dbal dev-master (f5b23c1 => 596d738)
    Checking out 596d738d0016e6e0701bcc066247396032605d29

Above action was done. But at the end I received below error

  [Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException]                                                       
  The service "symfony_cmf_block.simple_admin" has a dependency on a non-existent parameter "symfony_cmf_content.content_basepath".

This is my config.yml.

sonata_block:
    default_contexts: [cms]
    blocks:
        sonata.admin.block.admin_list:
            contexts:   [admin]
        sonata_admin_doctrine_phpcr.tree_block:
            settings:
                id: '/cms'
            contexts:   [admin]

sonata_admin:
    templates:
        # default global templates
        ajax:    SonataAdminBundle::ajax_layout.html.twig
    dashboard:
        blocks:
            # display a dashboard block
            - { position: right, type: sonata.admin.block.admin_list }
            - { position: left, type: sonata_admin_doctrine_phpcr.tree_block }

sonata_doctrine_phpcr_admin:
    document_tree:
        Doctrine\PHPCR\Odm\Document\Generic:
            valid_children:
                - all
        Symfony\Cmf\Bundle\SimpleCmsBundle\Document\Page: ~
        Symfony\Cmf\Bundle\RoutingExtraBundle\Document\Route:
            valid_children:
                - Symfony\Cmf\Bundle\RoutingExtraBundle\Document\Route
                - Symfony\Cmf\Bundle\RoutingExtraBundle\Document\RedirectRoute
        Symfony\Cmf\Bundle\RoutingExtraBundle\Document\RedirectRoute:
            valid_children: []
        Symfony\Cmf\Bundle\MenuBundle\Document\MenuItem:
            valid_children:
                - Symfony\Cmf\Bundle\MenuBundle\Document\MenuItem
                - Symfony\Cmf\Bundle\MenuBundle\Document\MultilangMenuItem
        Symfony\Cmf\Bundle\MenuBundle\Document\MultilangMenuItem:
            valid_children:
                - Symfony\Cmf\Bundle\MenuBundle\Document\MenuItem
                - Symfony\Cmf\Bundle\MenuBundle\Document\MultilangMenuItem

fos_js_routing:
    routes_to_expose:
        - admin_sandbox_main_editablestaticcontent_create
        - admin_sandbox_main_editablestaticcontent_delete
        - admin_sandbox_main_editablestaticcontent_edit
        - admin_bundle_menu_menuitem_create
        - admin_bundle_menu_menuitem_delete
        - admin_bundle_menu_menuitem_edit
        - admin_bundle_menu_multilangmenuitem_create
        - admin_bundle_menu_multilangmenuitem_delete
        - admin_bundle_menu_multilangmenuitem_edit
        - admin_bundle_content_multilangstaticcontent_create
        - admin_bundle_content_multilangstaticcontent_delete
        - admin_bundle_content_multilangstaticcontent_edit
        - admin_bundle_routingextra_route_create
        - admin_bundle_routingextra_route_delete
        - admin_bundle_routingextra_route_edit
        - admin_bundle_simplecms_page_create
        - admin_bundle_simplecms_page_delete
        - admin_bundle_simplecms_page_edit
        - symfony_cmf_tree_browser.phpcr_children
        - symfony_cmf_tree_browser.phpcr_move
        - sonata.admin.doctrine_phpcr.phpcrodm_children
        - sonata.admin.doctrine_phpcr.phpcrodm_move

doctrine_phpcr:
    session:
        backend:
            type: doctrinedbal
            connection: doctrine.dbal.default_connection
        workspace: default
        username: admin
        password: admin
    odm:
        auto_mapping: true

I figured out the configuration in vendor/symfony-cmf/block-bundle/Symfony/Cmf/Bundle/BlockBundle/Resources/config/admin.xml file. How to fix it

Help me to figure out the issue

[proposal] Refactor BlockAdmin to support inheritance

I think it should be possible to support inheritance in SonataAdmin, so effectively we can have just a single list of block contents and one item on the dashboard "Block Content"

I think this would make the interface less confusing and remove duplicate code.

We could also tidy up the code a bit whilst we're at it, maybe moving the various XML admin configs into a single file, or at least prefix them with "admin" instead of suffixing them. (difficult to see whats going in the config folder)

ActionBlock + FragmentHandler - error if fragments enabled

When the action block is used and the fragment handler is enabled the parameters are not passed correctly to the action block controller.

#app/config/config.yml
framework:
    # ...
    fragments:       { path: /_fragment }

Above config enables the Symfony\Component\HttpKernel\EventListener\FragmentListener that is otherwise not loaded. It seems the parameters are lost here.

handling not found blocks

it seems a block loader may not return null, but our phpcr block loader does. this is dangerous. we should have some sort of empty block that we can return in such a case. (we do not want an exception as the template should define the slot for the block and we do not want to check for existence in the template first).

see also sonata-project/SonataBlockBundle#44 (comment) for discussion

Refactor multilang admins

The multilang admins are integrated in the normal admin for the Menu + Routing bundle. We should also do this for the BlockBundle.

This means:

  • Remove Multilang* classes
  • Implement TranslatableInterface from CoreBundle in all Blocks that may be multilang
  • No need to do anything about the admins, there is an admin extension for the TranslatableInterface that will do stuff if enabled.

Web Testing

We need to add web tests to this bundle, precedents can be found in:

  • MenuBundle
  • SimpleCmsBundle
  • RoutingBundle
  • Admin Tests
  • Frontend Tests

Admin tests

  • We should create one WebTest for each admin.
  • These tests should test list, edit and create with submission. (the above bundles all implement the same set of tests, its not complete but its consistent - they can be used as a model).
  • A base test class can be used to reduce the amount of code (e.g. the list test is very similar for each test case)

Frontend tests

  • Create either one page with all blocks or a page for each block.
  • These page(s) should at minimum render the block, but also allow us to add different configurations of the same block.
  • Add a 200 OK test for each page.

I would also like to make these pages "demos" which show the code used to render each block, as the test application can be served as a web application.

Loose version restriction on sonata-block-bundle

Version 2.2.0 of sonata-block contains a bug (see sonata-project/SonataBlockBundle#61)

For now I can help myself with ""sonata-project/block-bundle":"2.2.1 as 2.2.0" but what is the restriction

"sonata-project/block-bundle": ">=2.1,<2.2.1"

good for?

Update: To be honest, the workaround doesn't work. However, the bug exists and hopefully the fix will be released the next days, but with limited to 2.2.0 it isn't installable at all.

doctrine filter to remove embedded blocks when editing rendered content

f.e. in frontend editing, the cmf_block_embed filter might have rendered blocks that get stored as rendered blocks on a save. we should have the filter output some special token to detect that this was content it generated and create a doctrine listener that on saving removes the generated stuff again and restores the call.
something like

....

(if the frontend editor goes destroying that something while editing, then screw him).

this concept could be applied to any filter thing somebody comes up with: if you provide a filter, you should provide a listener as well. each filter you activate is going to cost you. listening on save operations should be comparably cheap as its not happening that often. and anyway is not more expensive than rendering the page.

filter should be set on a slideshow

the imagine filter has to be set on the image. this is obviously quite flexible but makes administration needlessly hard. ideally one could set a default filter for a given slideshow on the slideshow itself.

slideshow block has too many fields for imagine admins

When the multilang is enabled and the slideshow block is used, the imagine admin automatically gets fields added for:

  • publish start date
  • publish end date
  • publishable
  • locale

The parent slideshow block already has these fields in it's form, so probably there values should be cascaded and the fields can be hidden for the imagine child admins

Global issue: symfony-cmf/core-bundle#81

Declaration of Symfony\Cmf\Bundle\BlockBundle\Block\StringBlockService::execute() must be compatible with that of Sonata\BlockBundle\Block\BlockServiceInterface::execute()

Getting this error today:

Fatal error: Declaration of Symfony\Cmf\Bundle\BlockBundle\Block\StringBlockService::execute() must be compatible with that of Sonata\BlockBundle\Block\BlockServiceInterface::execute() in ......./vendor/symfony-cmf/block-bundle/Symfony/Cmf/Bundle/BlockBundle/Block/StringBlockService.php on line 12

Probably also occurs in the other files in that folder.

See sonata-project/SonataDoctrineORMAdminBundle#213 for possible solution?

Sonata Admin fatal errors when adding blocks

Unsure if this is the correct repo to raise the issue, but adding any kind of block on the Sonata Admin will produce the fatal error:

Catchable Fatal Error: Argument 1 passed to Symfony\Cmf\Bundle\BlockBundle\Document\BaseBlock::setParent() must implement interface Sonata\BlockBundle\Model\BlockInterface, instance of Doctrine\ODM\PHPCR\Document\Generic given, called in /home/gez/Dev/git/cmf-sandbox/vendor/symfony/symfony/src/Symfony/Component/Form/Util/PropertyPath.php on line 538 and defined in /home/gez/Dev/git/cmf-sandbox/vendor/symfony-cmf/block-bundle/Symfony/Cmf/Bundle/BlockBundle/Document/BaseBlock.php line 220

CMF Sandbox also fails at this point, although fatal error is not displayed:

http://cmf.liip.ch/en/admin/dashboard

No $bundles variable to reference in the CmfBlockExtension load() method

Around line 52, there is this code:

// detect bundles
if ($config['use_imagine'] ||
    ('auto' === $config['use_imagine'] && isset($bundles['LiipImagineBundle']))
) {
    $useImagine = true;
} else {
    $useImagine = false;
}

There doesn't seem to be a $bundles variable defined or a line before this code like:

$bundles = $container->getParameter('kernel.bundles');

So if you do not have the LiipImagineBundle and have not changed the default "auto" value, there will be services loaded that probably shouldn't be loaded.

SlideshowBlock

this block will essentially provide an image slideshow

Use manager registry instead of document manager

I thought I should log this as an issue before going ahead with any changes:

In RoutingBundle PRs 97 and 99, classes that use a document manager now require ManagerRegistry $managerRegistry as a constructor argument and a call to a new method setManagerName($managerName).

I propose to make a similar change to BlockBundle in order to be more consistent with RoutingBundle, updating the functionality that was added in PR 54.

Affected class: PHPCRBlockLoader
Affected service: cmf.block.service
New config item: manager_registry

Possible concerns:

  • The class is called "PHPCRBlockLoader", so does it make sense to make it more generic/able to load from different object managers? If so, should it be renamed?
  • RoutingBundle has the config item manager_name, while BlockBundle has document_manager_name, albeit at different levels in the config tree. If these are equivalent, should one be renamed?

Just want to make sure it's worth doing, and that we don't cause any problems. :)

GetReferrers Bug

I am pretty sure I have uncovered a bug with the Doctrine\ODM\PHPCR\DocumentManager getReferrers method when using a custom/user defined Block.

Here is code I have in my controller. Using my own MyReferenceBlock fails while ReferenceBlock works as expected

use Symfony\Cmf\Bundle\BlockBundle\Document\ReferenceBlock;
use Symfony\Cmf\Bundle\BlockBundle\Document\ContainerBlock;
use Acme\Bundle\MainBundle\Document\MyReferenceBlock;
//..
        $manager = $this->get('doctrine_phpcr.odm.document_manager');
        $session = $manager->getPhpcrSession();

        $basepath = $this->container->getParameter('cmf_content.static_basepath');
        NodeHelper::createPath($session, $basepath);

        $parent = $manager->find(null, $basepath);
        $containerParent = new ContainerBlock('container-parent');
        $containerParent->setParentDocument($parent);
        $manager->persist($containerParent);

        //$referenceBlock = new ReferenceBlock;//this works as expected
        $referenceBlock = new ReferenceContainerBlock;//this fails
        $referenceBlock->setName('reference-block');
        $referenceBlock->setParent($containerParent);
        $referenceBlock->setReferencedBlock($manager->find(null, '/content/container parent'));
        $manager->persist($referenceBlock);

Notice that I am using my own block MyReferenceBlock, This block looks exactly like the dfault ReferenceBlock. Here it is:

namespace Acme\Bundle\MainBundle\Document;

use Symfony\Cmf\Bundle\BlockBundle\Document\BaseBlock;

use Doctrine\ODM\PHPCR\Mapping\Annotations as PHPCRODM;

/**
 * Block that is a reference to another block
 *
 * @PHPCRODM\Document(referenceable=true)
 */
class MyReferenceBlock extends BaseBlock
{
    /** @PHPCRODM\ReferenceOne */
    private $referencedBlock;

    public function getType()
    {
        return 'cmf.block.reference';
    }

    public function getReferencedBlock()
    {
        return $this->referencedBlock;
    }

    public function setReferencedBlock($referencedBlock)
    {
        return $this->referencedBlock = $referencedBlock;
    }
}

The problem is that when I use the following code the script fails without an exception:

$referenceBlock = $manager->find(null, '/content/container-parent');
//this line fails
var_dump($manager->getReferrers($referenceBlock)->count());

This simple example shows what I did to recreate the bug. Maybe I am doing something wrong, but from what I gather from the docs, we should be able to define out own blocks as I have done, and I would expect that the getReferrers would work as it does for ReferenceBlock

BaseAdminExtension refactor

we should eliminate the enabled explicit field and map it to the publishable field added in #101 instead. it is pretty redundant.

this leaves only the ttl field in the BaseAdminExtension class. i think we should still keep that, as its a way to control where you want the ttl to be editable. the extension should go into Admin/Extension and make it have Block in the name.

Annotation Exception

[Doctrine\Common\Annotations\AnnotationException]
[Creation Error] The annotation @PHPCRODM\Child declared on property Symfony\Cmf\Bundle\BlockBundle\Document\ImagineBlock::$image does not have a property named "name". Available properties: nodeName, cascade

I am seeing the above error after composer update or cache clear

Here are my deps, I am just investigating around so these might not be ideal

{
    "name": "symfony/framework-standard-edition",
    "description": "The \"Symfony Standard Edition\" distribution",
    "autoload": {
        "psr-0": { "": "src/" }
    },
    "require": {
        "php": ">=5.3.3",
        "symfony/symfony": "2.2.*",
        "doctrine/orm": "~2.2,>=2.2.3",
        "doctrine/doctrine-bundle": "1.2.*",
        "twig/extensions": "1.0.*",
        "symfony/assetic-bundle": "2.1.*",
        "symfony/swiftmailer-bundle": "2.2.*",
        "symfony/monolog-bundle": "2.2.*",
        "sensio/distribution-bundle": "2.2.*",
        "sensio/framework-extra-bundle": "2.2.*",
        "sensio/generator-bundle": "2.2.*",
        "jms/security-extra-bundle": "1.4.*",
        "jms/di-extra-bundle": "1.3.*",

        "doctrine/doctrine-fixtures-bundle": "2.1.*",
        "jackalope/jackalope-doctrine-dbal": "dev-master",
        "symfony-cmf/menu-bundle": "dev-master",
        "symfony-cmf/block-bundle": "dev-master",
        "symfony-cmf/content-bundle": "dev-master",
        "symfony-cmf/routing-auto-bundle": "dev-master",
        "sonata-project/admin-bundle": "dev-master",
        "sonata-project/doctrine-phpcr-admin-bundle": "dev-master"
    },
    "scripts": {
        "post-install-cmd": [
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
        ],
        "post-update-cmd": [
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
        ]
    },
    "minimum-stability": "dev",
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web"
    }
}

No identifier/path specified for Document

I recently updated to symfony-cmf/BlockBundle 1.0.0-RC1 as the follow composer output shows
- Updating symfony-cmf/block-bundle (1.0.0-beta3 => 1.0.0-RC1)

When I did this I started getting the following fatal error:
FatalErrorException: Error: Class 'Symfony\Cmf\Bundle\BlockBundle\Document\ContainerBlock' not found in src/App/Document/CustomBlock.php

I thought that this would resolve if I swapped in the following ContainerBlock class
use Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\ContainerBlock;

however I am now getting the following error
No identifier/path specified for Document "App\Document\CustomBlock" sub class of "Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\ContainerBlock". Every Document must have an identifier/path.

Hoping someone can help steer me in the right direction, how can I add the identifier/path? Or am I going down the wrong path? Thanks

Ability to embed block services that aren't stored in PHPCR

It would be good to be able to embed a standard sonata block service that is not stored in PHPCR into a PHPCR document's content area so it is handled by cmf_embed_blocks or a similar twig filter.

The use case would be if you want to show 3 featured products from a product database on the home page. You could embed a product block service (service id sonata.block.service.project in this example) in the content using syntax like

%embed-block|sonata.block.service.project|end%

Additionally you would want to be able to specify options to the embedded block so you could tell it you want to show only featured projects and limit it to 3

%embed-block|sonata.block.service.project &featured=`1` &limit=`3`|end%

I'm not sure how useful the options would be for the cmf stored blocks but it seems like there could be a use case.

I already have a working example of this in a completely separate filter which is based on the cmf_embed_blocks filter. I would be interested in hearing from folks about

  1. Is this a feature we want to add

  2. Should it be a separate twig filter or supported by the existing one?

    Since the syntax would be the same except we'd have to determine whether we are dealing with a service id or a path which should be a matter of simply asking sonata block's BlockManager if it has/supports a block with that service id and if not fall back to current behavior of loading from cmf. Additionally not requiring 2 filters to be executed seems to be a performance gain.

  3. Thoughts on the options format (using ampersands is less than ideal as they can get htmlencoded and then you have to handle those, the example I gave is based on the modx snippet syntax. Wordpress doesnt use the ampersands or the backticks for example.

Clean up code and remove duplication in BlockBundle

  • Remove duplicated code in Admin classes
  • We should probably either merge all the admin service.xml files into one file or at least prefix "admin" them instead of suffixing it - its difficult to see where things are currently.
  • Move mapping to xml

The simple_cmf_block.content_basepath configuration is not used

When the following configuration is set:

symfony_cmf_block:
    content_basepath: /

The base path value is still set to "/cms/content". I believe this is due to the parameter in the Resources/config/container.admin.xml file (00feeba). Also the DependencyInjection/SymfonyCmfBlockExtension.php doesn't seem to be checking for a 'content_basepath' config value.

investiage symfony 2.2 compat

travis started failing for symfony 2.2 today. i wonder if its again an issue of basing us on a stable version of twig?

Caching: Settings passed form sonata_render_block are dropped from cached results

Settings passed form sonata_render_block are dropped from cached results. This also happens in the SonataPageBundle, so maybe it is better to solve this in the SonataBlockBundle.

This was found during implementation of sonata caching #16, but could not be solved then.

An idea to solve this is to create a pool for the configurations and cache them in APC, then the ESI, SSI and JS cache can first fetch the configuration and pass it to the ChainLoader.

A block could also be used multiple times on the same page with different settings (fe. a generic list block), this is also related to "execution contexts" sonata-project/SonataBlockBundle#11? If an execution context can be made unique, it can also be saved (in APC) and used for caching as described in previous idea.

SlideshowContainerBlock

this block will provide a "slideshow" of block instances. it would therefore build on top of ContainerBlock and would likely leverage the async loading of blocks we got via the integration of SonataCacheBundle.

cleanup slideshow admin when features are implemented

#32 has a couple of open todos blocked by sonata and phpcr-odm missing features

Error in Symfony2 project cache:clear warmUp without symfony-cmf/media-bundle

When attempting to use the symfony-cmf/block-bundle standalone in a Symfony2 project with the following configuration:

cmf_block:
    persistence:
        phpcr:
            enabled: true
            use_sonata_admin: false
            content_basepath: /
    use_imagine: false

When the symfony-cmf/media-bundle package is not included in the Symfony2 project composer.json, the following error is displayed when executing the php app/console cache:clear command:

  [Doctrine\Common\Proxy\Exception\UnexpectedValueException]                                                                                 
  The type hint of parameter "image" in method "setImage" in class "Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\ImagineBlock" is invalid.  


  [ReflectionException]                                               
  Class Symfony\Cmf\Bundle\MediaBundle\ImageInterface does not exist  

The CmfBlockBundle build() method will trigger a compiler pass call to DoctrinePhpcrMappingsPass::createXmlMappingDriver() which will load the XML files in the Resources/config/doctrine-phpcr/ directory, which includes the ImagineBlock.phpcr.xml file.

The cache:clear will eventually trigger the Symfony\Bridge\Doctrine\CacheWarmer\ProxyCacheWarmer warmUp() method which wants to generate proxy classes for loaded classes (including the one from ImagineBlock.phpcr.xml), eventually calling Doctrine\Common\Proxy\ProxyGenerator generateMethods() where the error above is thrown.

Of course, when the symfony-cmf/media-bundle package is included in the Symfony2 project composer.json, the error is gone.

Should the symfony-cmf/media-bundle package be required in this bundle's composer.json?

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.