Weave Code
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

Bundles Cms Laravel Package

kunstmaan/bundles-cms

Kunstmaan CMS is a full-featured, multilingual CMS built on the Symfony full-stack framework. It offers page and form assembly, versioning, workflow, translation tools, and media management, plus integrations with community bundles.

View on GitHub
Deep Wiki
Context7

KunstmaanConfigBundle

Installation

This bundle is compatible with all Symfony 3.* releases. More information about installing can be found in this line by line walkthrough of installing Symfony and all our bundles, please refer to the Getting Started guide and enjoy the full blown experience.

Usage

This bundle allows you to create a entity that extends the AbstractConfig class. By doing this you can create a settings form with some custom configuration variables.

Create entity

Create a new entity with the fields you would like to be configurable. This can be for example a site emailaddress, the site logo, ...

Change the created entity and let it extend the AbstractConfig class instead of the default AbstractEntity class.

By extending this class you will have to implement some methods from the ConfigurationInterface.

    /**
    * This function is optional. Implement it if you would like a other ROLE to access the configuration section.
    **/
    public function getRoles()
    {
        return array('ROLE_ADMIN');
    }

    /**
     * Returns the form type to use for this configuratble entity.
     *
     * [@return](https://github.com/return) string
     */
    public function getDefaultAdminType()
    {
        return new SiteConfigType();
    }

   /**
    * The internal name will be used as unique id for the route etc.
    *
    * Use a name with no spaces but with underscores.
    *
    * [@return](https://github.com/return) string
    */
    public function getInternalName()
    {
        return 'siteconfig';
    }

     /**
     * Returns the label for the menu item that will be created.
     *
     * [@return](https://github.com/return) string
     */
    public function getLabel()
    {
        return 'Configuration';
    }

Create the form

You can let symfony autogenerate your form for your custom entity. This formtype needs to be returned by the getDefaultAdminType() function.

Add the created entity to your config.yml file.

kunstmaan_config:
    entities:
        - path\toBundle\Entity\CustomEntity

Add the kunstmaan_config routing to your routing.yml

kunstmaan_config:
    resource: "[@KunstmaanConfigBundle](https://github.com/KunstmaanConfigBundle)/Resources/config/routing.yml"
    prefix:   /{_locale}/

Result

When you browse to "Settings" in the main menu, you will see that there is a new menu item available with the label you have chosen.

Twig

There is a custom ConfigTwigExtension with the function get_config_by_internal_name.

The function needs the internal name of your entity as parameter.

You can use this function in your twig template to get your configuration variables.

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.
directorytree/privacy-filter-classifier
directorytree/privacy-filter
babenkoivan/elastic-client
innmind/static-analysis
innmind/coding-standard
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi
splash/scopes
splash/toolkit