nassau / kunstmaan-node-settings-bundle
Installs: 14 202
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- kunstmaan/bundles-cms: ~3.2 | ~4.0 | ~5.0
- nassau/registry-compiler: ~1.1
This package is auto-updated.
Last update: 2024-10-23 19:52:45 UTC
README
Installation
Just composer require nassau/kunstmaan-node-settings-bundle
and add \Nassau\KunstmaanNodeSettingsBundle\NodeSettingsBundle
to your AppKernel file.
Usage
- Create an Entity to hold your settings (it’s best if it has relation to a
NodeTranslation
, but it’s up to you) and a FormType for it - Create a SettingsHandler. To do this implement the
\Nassau\KunstmaanNodeSettingsBundle\Services\NodeSettingsHandlerInterface
interface and register that service in the container with anassau.node_settings
tag - Your form type will automatically show up when editing the node, and the entity will be persisted on save. Et voilà!
Kitchen sink
The whole aim of this bundle is to be simple. So instead of creating everything from scratch, let’s use some existing boilerplate.
AbstractNodeSettingEntity
Use this class as a base for your entity so you’d have a nodeTranslation
association defined out of the box.
AbstractNodeSettingsHandler
Extend this class to have a simpler handler. It will use defaults for most of the values and only require you to set:
- The name of the entity class for your settings
- The name of the form type class
- And the name of the handler itself
The settings node will be automatically fetched and saved based on the current NodeTranslation
.
Examples
Ok, so you still don’t get it and need a TL;DR or an example? Look at the examples