SeoBundle

SeoBundle

The SeoBundle has no documents of its own and thus no stand alone admins. For the SeoAwareInterface, we provide an admin extension that uses the form provided by the SeoBundle. This allows to edit a SeoMetadata object in admins for documents that implement seo aware.

Caution

The Sonata Admin uses the form type provided by the CmfSeoBundle. That form type requires to have the BurgovKeyValueFormBundle installed.

Configuration

This section configures the admin extension for SEO aware content.

  • YAML
    1
    2
    3
    4
    5
    6
    7
    8
    9
    # app/config/config.yml
    cmf_sonata_phpcr_admin_integration:
        bundles:
            seo:
                enabled: true
                extensions:
                    metadata:
                        form_group: form.group_seo
                        form_tab: form.tab_seo
    
  • XML
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    <!-- app/config/config.xml -->
    <?xml version="1.0" encoding="UTF-8" ?>
    <container xmlns="http://symfony.com/schema/dic/services">
        <config xmlns="http://cmf.symfony.com/schema/dic/sonata-phpcr-admin-integration">
            <bundles>
                <seo enabled="true">
                    <extensions>
                        <metadata
                            form-group="form.group_seo"
                            form-tab="form.tab_seo"
                        />
                    </extensions>
                </seo>
            </bundles>
        </config>
    </container>
    
  • PHP
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    // app/config/config.php
    $container->loadFromExtension('cmf_sonata_phpcr_admin_integration', [
        'bundles' => [
            'seo' => [
                'enabled' => true,
                'extensions' => [
                    'metadata' => [
                        'form_group' => 'form.group_seo',
                        'form_tab' => 'form.tab_seo',
                    ],
                ],
            ],
        ],
    ];
    

enabled

type: bool default: false

If true, the admin classes and extensions of this package are loaded and available for Sonata Admin.

Tip

If you do not see this admin on the Sonata dashboard, you need to configure the dashboard to show the admin service in question. Read more about this in the Sonata Admin documentation.

form_group

type: string default: form.group_seo

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: form.tab_seo

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.

SeoAwareInterface Admin Extension

This extension allows to edit SeoMetadata in any admin for a document that implements SeoAwareInterface.

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
    # app/config/config.yml
    sonata_admin:
        # ...
        extensions:
            cmf_sonata_phpcr_admin_integration.seo.extension.metadata:
                implements:
                    - Symfony\Cmf\Bundle\SeoBundle\SeoAwareInterface
    
  • XML
    1
    2
    3
    4
    5
    6
    7
    8
    9
    <!-- 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.seo.extension.metadata">
                <implements>Symfony\Cmf\Bundle\SeoBundle\SeoAwareInterface</implements>
            </extension>
        </config>
    </container>
    
  • PHP
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    // app/config/config.php
    use Symfony\Cmf\Bundle\SeoBundle\SeoAwareInterface;
    
    $container->loadFromExtension('sonata_admin', [
        'extensions' => [
            'cmf_sonata_phpcr_admin_integration.seo.extension.metadata' => [
                'implements' => [
                    SeoAwareInterface::class,
                ],
            ],
        ],
    ]);
    

See the Sonata Admin extension documentation for more information.

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.