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

Form Collection Additions

As we regularly use forms which contain sub entities, we also added support for these.

Default implementation

To use our default implementation you only have to set the nested_form attribute to true on your collection fields :

class MyAdminType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        ...
        $builder->add(
            'prices',
            CollectionType::class,
            array(
                'type'               => new SeriesPriceAdminType(),
                'allow_add'          => true,
                'allow_delete'       => true,
                'by_reference'       => false,
                'attr'               => array(
                    'nested_form'           => true,
                )
            )
        );
        ...
    }
}

You can also specify a minimum and/or maximum number of items for the collection, by passing nested_form_min and/or nested_form_max attributes.

Drag & drop sorting

There also is support for drag & drop sorting of the collection elements, this can be enabled by passing in the nested_sortable and - optionally - the nested_sortable_field attributes.

class MyAdminType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        ...
        $builder->add(
            'prices',
            CollectionType::class,
            array(
                'type'               => new MySubAdminType(),
                'allow_add'          => true,
                'allow_delete'       => true,
                'by_reference'       => false,
                'attr'               => array(
                    'nested_add_button_label' => 'form.nested.add',
                    'nested_form'             => true,
                    'nested_sortable'         => true,
                    'nested_sortable_field'   => 'displayOrder',
                )
            )
        );
        ...
    }
}

class MySubAdminType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        ...
        $builder->add('displayOrder', HiddenType::class);
        ...
    }
}

If you don't set the nested_sortable_field attribute, a default of "weight" will be used (so you must make sure your form type has a getter and setter for a weight field if you don't set it).

You can override the default "form.add" button label - this is the translation key! - with the nested_add_button_label attribute.

Many to Many relations

If you have a many-to-many relation, you wouldn’t want to delete the related entity when removing it from page part. In order to skip this, set nested_deletable => false attribute, i.e.:

'attr' => array(
    'nested_form'           => true,
    'nested_deletable'      => false,
)
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