CoreBundle
CoreBundle¶
The CoreBundle has no own documents that can be edited, but we provide admin extensions under the core bundle namespace that are useful for all documents.
Admin extensions can be added to admin services through configuration in the SonataAdminBundle. See the Sonata Admin extension documentation for more information.
We provide the child extension to help with adding documents in overlay dialogs, and extensions to edit publish workflow information.
Configuration¶
This section configures the admin extensions for publish workflow editing.
- YAML
1 2 3 4 5 6 7 8 9 10 11
# app/config/config.yml cmf_sonata_phpcr_admin_integration: bundles: core: extensions: publishable: form_group: form.group_publish_workflow form_tab: form.tab_publish publish_time: form_group: form.group_publish_workflow form_tab: form.tab_publish
- XML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
<!-- app/config/config.xml --> <?xml version="1.0" charset="UTF-8" ?> <container xmlns="http://symfony.com/schema/dic/services"> <config xmlns="http://cmf.symfony.com/schema/dic/sonata-phpcr-admin-integration"> <bundles> <extension> <publishable form-group="form.group_publish_workflow" form-tab="form.tab_publish" /> <publish-time form-group="form.group_publish_workflow" form-tab="form.tab_publish" /> </extension> </bundles> </config> </container>
- PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
// app/config/config.php $container->loadFromExtension('cmf_sonata_phpcr_admin_integration', [ 'bundles' => [ 'core' => [ 'extensions' => [ 'publishable' => [ 'form_group' => 'form.group_publish_workflow', 'form_tab' => 'form.tab_publish', ], 'publish_time' => [ 'form_group' => 'form.group_publish_workflow', 'form_tab' => 'form.tab_publish', ], ], ], ], ]);
Note that the child extension has no configuration and just can be attached to admins as needed - see below for details.
form_group
¶
type: string
default: as in above example.
The name of the form group to use in the admin extension.
The caption for the group is determined by translating the group name. If you change the group, be sure to also define a translation for it.
form_tab
¶
type: string
default: as in above example.
The name of the form tab to use in the admin extension.
The caption for the tab is determined by translating the tab name. If you change the tab name, be sure to also define a translation for it.
Using Child Models: The Child Sonata Admin Extension¶
This extension sets a default parent to every new object instance if a
parent
parameter is present in the URL. The parent parameter is present
for example when adding documents in an overlay with the
doctrine_phpcr_odm_tree_manager
or when adding a document in the tree of
the dashboard.
To activate the extension in your admin classes, define the extension
configuration in the sonata_admin
section of your project configuration:
- YAML
1 2 3 4 5 6 7 8
# app/config/config.yml sonata_admin: # ... extensions: cmf_sonata_phpcr_admin_integration.core.extension.child: implements: - Symfony\Cmf\Bundle\CoreBundle\Model\ChildInterface - Doctrine\ODM\PHPCR\HierarchyInterface
- XML
1 2 3 4 5 6 7 8 9 10 11 12
<!-- app/config/config.xml --> <?xml version="1.0" charset="UTF-8" ?> <container xmlns="http://symfony.com/schema/dic/services"> <config xmlns="http://sonata-project.org/schema/dic/admin"> <!-- ... --> <extension id="cmf_sonata_phpcr_admin_integration.core.extension.child"> <implements>Symfony\Cmf\Bundle\CoreBundle\Model\ChildInterface</implements> <implements>Doctrine\ODM\PHPCR\HierarchyInterface</implements> </extension> </config> </container>
- PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
// app/config/config.php use Symfony\Cmf\Bundle\CoreBundle\Model\ChildInterface; use Doctrine\ODM\PHPCR\HierarchyInterface; $container->loadFromExtension('sonata_admin', [ // ... 'extensions' => [ 'cmf_sonata_phpcr_admin_integration.core.extension.child' => [ 'implements' => [ ChildInterface::class, HierarchyInterface::class, ], ], ], ]);
Editing publication information: Publish Workflow Sonata Admin Extension¶
When using the write interface of the publish workflow, this admin extension can be used to edit publication information.
To activate the extensions in your admin classes, define the extension
configuration in the sonata_admin
section of your project configuration:
- YAML
1 2 3 4 5 6 7 8 9 10
# app/config/config.yml sonata_admin: # ... extensions: cmf_sonata_phpcr_admin_integration.core.extension.publish_workflow.publishable: implements: - Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishableInterface cmf_sonata_phpcr_admin_integration.core.extension.publish_workflow.time_period: implements: - Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishTimePeriodInterface
- XML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
<!-- app/config/config.xml --> <?xml version="1.0" encoding="UTF-8" ?> <container xmlns="http://symfony.com/schema/dic/services"> <config xmlns="http://sonata-project.org/schema/dic/admin"> <!-- ... --> <extension id="cmf_sonata_phpcr_admin_integration.core.extension.publish_workflow.publishable"> <implements> Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishableInterface </implements> </extension> <extension id="cmf_sonata_phpcr_admin_integration.core.extension.publish_workflow.time_period"> <implements> Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishTimePeriodInterface </implements> </extension> </config> </container>
- PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
// app/config/config.php use Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishableInterface; use Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishTimePeriodInterface; $container->loadFromExtension('sonata_admin', [ // ... 'extensions' => [ 'cmf_sonata_phpcr_admin_integration.core.extension.publish_workflow.publishable' => [ 'implements' => [ PublishableInterface::class, ], ], 'cmf_sonata_phpcr_admin_integration.core.extension.publish_workflow.time_period' => [ 'implements' => [ PublishTimePeriodInterface::class, ], ], ], ]);
This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.