2017 © Pedro PelĂĄez
 

library kunstmaan-node-settings-bundle

image

nassau/kunstmaan-node-settings-bundle

  • Tuesday, February 6, 2018
  • by mlebkowski
  • Repository
  • 1 Watchers
  • 3 Stars
  • 6,273 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 12 % Grown

The README.md

Finally! A swift way of adding custom settings to any node in Kunstmaan Bundles CMS

Installation

Just composer require nassau/kunstmaan-node-settings-bundle and add \Nassau\KunstmaanNodeSettingsBundle\NodeSettingsBundle to your AppKernel file., (*1)

Usage

  1. 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
  2. Create a SettingsHandler. To do this implement the \Nassau\KunstmaanNodeSettingsBundle\Services\NodeSettingsHandlerInterface interface and register that service in the container with a nassau.node_settings tag
  3. 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., (*2)

AbstractNodeSettingEntity

Use this class as a base for your entity so you’d have a nodeTranslation association defined out of the box., (*3)

AbstractNodeSettingsHandler

Extend this class to have a simpler handler. It will use defaults for most of the values and only require you to set:, (*4)

  • 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., (*5)

Examples

Ok, so you still don’t get it and need a TL;DR or an example? Look at the examples, (*6)

The Versions