Code Monkey home page Code Monkey logo

suluformbundle's Introduction

SuluFormBundle

Official Sulu Bundle Badge

GitHub license GitHub tag (latest SemVer) Test workflow status Sulu compatibility


The SuluFormBundle adds support for creating dynamic forms in Sulu Admin. It can be used for contact, sweepstake or other forms.


Sulu Form Slideshow


The SuluFormBundle is compatible with Sulu starting from version 2.0. Have a look at the require section in the composer.json to find an up-to-date list of the requirements of the bundle.

๐Ÿš€ย  Installation and Documentation

Execute the following composer command to add the bundle to the dependencies of your project:

composer require sulu/form-bundle

Afterwards, visit the bundle documentation to find out how to set up and configure the SuluFormBundle to your specific needs.

๐Ÿ’กย  Key Concepts

The bundle allows that the content manager itself can create dynamic forms over the admin ui. This form fields can be position by the content manager in a basic grid. Also the content manager configure the email which is sent to the visitor or them selfs. The bundle is build on top of the Symfony Form Component and use its theming features.

โค๏ธย  Support and Contributions

The Sulu content management system is a community-driven open source project backed by various partner companies. We are committed to a fully transparent development process and highly appreciate any contributions.

In case you have questions, we are happy to welcome you in our official Slack channel. If you found a bug or miss a specific feature, feel free to file a new issue with a respective title and description on the the sulu/SuluFormBundle repository.

๐Ÿ“˜ย  License

The Sulu content management system is released under the under terms of the MIT License.

suluformbundle's People

Contributors

alexander-schranz avatar chirimoya avatar cirykpopeye avatar codebarista avatar danrot avatar datenwerk-at avatar dev-newvisibility avatar dominikmatt avatar draganmilijasevic avatar etidimjav avatar floriankoerner avatar henri9813 avatar kleinkoerkamp avatar luca-rath avatar mamazu avatar manuxi avatar markusmoosbrugger avatar martinlagler avatar niklasnatter avatar opctim avatar plozmun avatar prokyonn avatar quehnie avatar raphaelhofer avatar rflorent avatar rs2487 avatar thomasduenser avatar tschannettm avatar tvwijgerden avatar wachterjohannes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

suluformbundle's Issues

Add text for notify email

The notify email should have also the possibility of adding a text e.g. when the form creator is not the receiver of the email.

Default theme

Add a form theme based on the form_div_layout.html.twig that it works without create a custom form theme.

Make dynamic entity blameable

If you use the form bundle with the community bundle it is nice to know the user ID of the user which filled the form.

Mandatory field on checkboxes

If i create a form field with checkboxes and set it as mandatory-field, nothing happens. The fields aren't declared as required.

Please remove the mandatory field marker from the checkboxes or set the attribute to every checkbox in checkboxes.

Group types in the dropdown

The dropdown with all available types should be grouped.

e.g.:

  • Text Types
    • Firstname
    • Lastname
    • ...
  • Complex Types
    • Checkbox
    • Select
  • Special Types
    • Attachment
    • Mailchimp
    • Recaptcha
  • Additional Types
    • Headline
    • FreeText
    • Spacer

Archive Form Data

when you use a page multiple times for a form you should be able to archive old data.

Migration script for older versions

The https://github.com/alexander-schranz/sulu-form-bundle 1.0 release should be migrate able to 0.1 of this repo.

TODO

Table Names:

  • l91_fo_dynamic -> fo_dynamics
  • l91_fo_form -> fo_forms
  • l91_fo_form_translations -> l91_fo_form_translations
  • l91_fo_form_fields -> fo_form_fields
  • l91_fo_form_field_translations -> fo_form_field_translations
RENAME TABLE `l91_fo_dynamic` TO `fo_dynamics`;
RENAME TABLE `l91_fo_form` TO `fo_forms`;
RENAME TABLE `l91_fo_form_field_translations` TO `fo_form_field_translations`;
RENAME TABLE `l91_fo_form_fields` TO `fo_form_fields`;
RENAME TABLE `l91_fo_form_translations` TO `fo_form_translations`;

Other changes:

  • CSRF Token include

Refractoring Bundle structure and form process

Here I describe the whole refractoring which is needed before the first release to avoid future bc breaks:

Structure

  • Admin
    • FormAdmin.php
    • FormNavigationProvider.php
    • DynamicListNavigationProvider.php ( new )
    • StaticListNavigationProvider.php ( rename )
  • Content
    • Types
      • FormSelect.php
  • Controller
    • FormController.php
    • FormWebsiteController.php
    • StaticController.php ( renamed )
    • DynamicController.php ( new )
  • DependencyInjection
    • CompilerPass
      • StaticListProviderCompilerPass.php ( rename )
      • DynamicListBuilderCompilerPass.php ( new )
      • DynamicFormFieldTypeCompilerPass.php ( new )
    • Configuration.php
    • SuluFormExtension.php
  • Dynamic
    • FormBuilder.php ( new )
    • FormBuilderInterface.php ( new )
    • FormFieldTypePool.php ( new )
    • FormFieldTypeInterface.php ( new )
    • Types
      • ...
  • Entity
    • Dynamic.php
    • Form.php
    • FormEmail.php ( new )
    • FormEmailTranslation.php ( new )
    • FormField.php
    • FormFieldTranslation.php
    • FormRepository.php ( moved )
    • FormTranslation.php
  • Event
    • Listener
      • RequestListener.php ( moved )
    • Subscriber
      • MailSubscriber.php ( new )
      • MailchimpListSubscriber.php ( moved )
      • FormSubmitSubscriber ( new )
    • FormValidateEvent.php ( new )
    • FormSubmitEvent.php ( new )
    • FormSavedEvent.php ( renamed )
  • Form
    • Type
      • AbstractType.php ( remove )
      • DynamicFormType ( refractor )
      • SuluMediaType ( new )
    • FormHandler.php ( refractor )
    • FormLoader.php ( new )
  • ListBuilder
    • DynamicListBuilder.php ( new )
    • DynamicListBuilderInterface.php ( new )
    • DynamicListFactory.php ( new )
    • DynamicListFactoryInterface.php ( new )
    • StaticListBuilder.php ( renamed (moved provider) )
    • StaticListFactory.php ( renamed (moved provider) )
  • Mail
    • SwiftMailerHelper.php ( renamed )
    • NullMailerHelper.php ( renamed )
    • MailerHelperInterface.php ( renamed )
  • Manager
    • FormManager.php
  • Media
    • CollectionStrategyInterface.php
    • CollectionTreeStrategy.php ( new default )
    • CollectionSingleStrategy.php
  • Resources
    • ...

FormBuilder

Main part is the Form builder what is needed to create a dynamic form.

  • Form ID
  • Type
  • TypeId
  • TypeName
  • Locale (optional)
  • Name (optional default "form") (needed when have multiple forms)

Dynamic Entity

  • uuid -> typeId
  • new type (default is "page")
  • new typeName (default is structure title)

Sketch

img_20161126_151337

TODOs

Exist issues and PRs:

  • #4 Dynamic Form Field Pool
  • #17 Include Mail Subscriber
  • #24 Split form from Structure

Rename placeholder to example

Since the placeholder shouldn't be used as placeholder, rename the field Placeholder to Example. It should be used as example field under the form-field like:

Label
Input
Example

Don't miss to add a documentation for the usage if the field should have a placeholder (use the title field as placeholder-item - in case of the required attribute)

bildschirmfoto 2017-03-15 um 14 15 23

Mandatory field on select

It's a issue in case of "bug" from symfony2 form theme.

If we have marked a select field (salutation) as mandatory field, symfony2 removes the required attribute from select (because no default option with empty value exist).
In this case the select field wouldn't be marked as required - only the label will be marked as required.

It isn't a important issue.

Integrate Form-Select into blocks

It will be nice to integrate the form-select content-type into blocks.
Currently one single form in blocks will work but data will not be visible in the Formula-Tab.

Include a Mailsubsriber to handle dynamic forms

Backend for CC and BCC mail receivers

  • Move form fields to top
  • Add new block with 2 Types (CC, BCC) and email and name field
  • Create FormTranslationEmails entity
  • FormManager handle save
  • Configuration to activate this feature
  • Configuration to set a mail template
    mail:
       cc: # canBeEnabled
       notify_template: "..."
       customer_template: "..."

Website

  • DynamicFormType deactivate here the default mails
  • MailSubscriber service ( listen to DynamicFormSaved event )
    • send Notify Emails with CC and BCC
    • send Customer Emails

Split form builder form structure

Currently only the formName is sent via the request all other data are read from the structure directly. https://github.com/alexander-schranz/sulu-form-bundle/blob/develop/Form/Builder.php#L81-L117

$id = FormId
$type = e.g. page, event, blog,
$typeId = e.g. pageUuid, blog id, event id
$typeName = e.g. pageTitel, blog titel
$locale = request.locale
$name = formName

To create the form only the formId, name and locale should be needed.
To save the form formId, locale, type, typeId should be needed.
For the media collection tree strategy also the typeName is needed to create a collection with the same name as the page.

Submitbutton Type

To have multiple submit buttons in the form add a new submit button type.

DateType widget 'single_text'

                DateType::class,
                [
                    'widget' => 'single_text',
                    'format' => 'dd/MM/yyyy',
                    'html5' => false,
                    'attr' => [
                        'placeholder' => 'form.possible_work_beginning',
                        'class' => 'js-datepicker'
                    ],
                    'required' => false,
                    'error_bubbling' => true,
                ]

Deactivate requestanalyzer for website action

The controller need to deactivate the requestAnalyzer to work correctly:

e.g.:

sulu_form.token:
    path: /form/token
    defaults: { _controller: SuluFormBundle:FormWebsite:token, _requestAnalyzer: false }

Also the ESI need to be called with _requestAnalyzer: false as attribute.

TODO:

  • Update documentation render_esi
  • Update website routing.yml

When not doing this the preview will not work correctly on pages with localization as folder.

Autofill api for logged in users

If you use the form bundle with the community bundle or other. It should be able to activate a autofill API. This should be a json api which autofill the form by an ajax request. JS need to be included by the user itself.

Only activatable by flag and need to configure which fields should be return because high risk of privacy!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.