Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Sonata Laravel Package

ekino/sonata

View on GitHub
Deep Wiki
Context7

Block selection dialog with categories

select-a-block.png

Configuration

To enable and configure this dialog (replacing the default dropdown and button) you have to configure it according to the following example:

sonata_helpers:
  compose_container:
    enabled: true
    categories:
      '':  "block.category.default"
      foo: "Foo"
      bar: "Bar"
    block_config:
      'App\Block\BannerBlockService':
        categories:
          - foo
      'App\Block\SimpleTextBlockService':
        only_pages:
          - home
        categories:
          - bar
      'App\Block\SkillsBlockService':
        categories:
          - foo
          - bar
  • enabled: Set to false to completely disable the feature. (Or do not add this configuration at all.)
  • categories: Key-label-list of all available categories. The empty key is the default category, assigned to all blocks without specified categories.
  • block_config: Assign one or more categories to each Block class.
  • categories: List of all categories (keys) in which the block should appear.
  • only_pages: Can be added to restrict a block to certain routes.

Important: If this features is enabled, the PageAdminController will be replaced by this bundle's version to override composeContainerShowAction(). If you need to extend it, please extend Sonata\HelpersBundle\Controller\PageAdminController.

Installation

This feature requires jQuery 2 or 3.

You need to make the following files available to the web frontend:

  • src/Resources/public/js/MutationObserver.js
  • src/Resources/public/css/blockSelectModal.scss

If for example you use Webpack-Encore, edit your webpack.config.js:

Encore.addStyleEntry('...', [
  ...
  path.resolve('/vendor/ekino/sonata/src/Resources/public/css/blockSelectModal.scss')
]);
...
Encore.addEntry('...', [
  ...
  path.resolve('/vendor/ekino/sonata/src/Resources/public/js/MutationObserver.js')
]);
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator