2017 © Pedro Peláez
 

silverstripe-module silverstripe-flexiform

Add CMS configurable forms to your SilverStripe objects.

image

briceburg/silverstripe-flexiform

Add CMS configurable forms to your SilverStripe objects.

  • Saturday, January 24, 2015
  • by briceburg
  • Repository
  • 4 Watchers
  • 19 Stars
  • 113 Installations
  • PHP
  • 1 Dependents
  • 1 Suggesters
  • 3 Forks
  • 6 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

silverstripe-flexiforms

Add CMS configurable forms to your SilverStripe objects., (*1)

Features

  • Add forms to any DataObject or Page
  • GridField based management of fields, options, submissions, actions, &c.
  • Programmatically define initial fields and handlers + build them from the Environment Builder
  • Many-many between Form and FlexiFormField, has_many between FlexiFormHandler
    • reduced repetitiveness and improved consistency
    • extraFields allows per-form customization without disturbing other forms using the same field
  • Protection against form re-submissions
  • Definable, friendly post URLs for logs and analytics
  • Support for multiple forms per page

Requirements

The venerable GridFieldExtensions https://github.com/ajshort/silverstripe-gridfieldextensions, (*2)

Tested in SilverStripe 3.1, (*3)

Screenshots

flexiform fields, (*4)

field editing, (*5)

Usage

  • Add flexiforms to Pages and DataObjects by extending with FlexiFormExtension. E.g.
class Event extends DataObject
{

    private static $extensions = array(
        'FlexiFormExtension'
    );

}

Trigger the environment builder (/dev/build) after extending objects -- You will now see the Form tab when editing Event in the CMS., (*6)

  • To display flexiforms, add $FlexiForm to your template. Here's a sample Event.ss;
<div class="event-content">
  <% if not FlexiFormPosted %>
    $Content
  <% end_if %>

  $FlexiForm    
</div>

Here we use $FlexiFormPosted to hide $Content if a form has been posted., (*7)

Flexiform also provides a convenience wrapper around the standard $Form method. Calling $Form from a Page extended by FlexiFormExtension will output the associated flexiform. E.g., (*8)

<div class="event-content">
  <% if not FlexiFormPosted %>
    $Content
  <% end_if %>

  $Form    
</div>

Works exactly the same as the first example., (*9)

Form Identifiers

Use Form Identifiers when you have multiple forms on a page, need to reference a form (e.g from another page), or want to control the post URL., (*10)

FlexiForm extends ContentController to provide the $FlexiForm method to all pages. By default it expects the controller's dataRecord to be an object extended by FlexiFormExtension. You can explicitly set the flexiform object by calling the setFlexiFormObject method on your controller, or by passing an Identifer to $FlexiForm., (*11)

Form Identifiers are defined in the Settings tab on flexiforms. The identifier is also used in post URLs for easy tacking of form submissions in server logs and analytics., (*12)





$FlexiForm('newsletter_form')

Shortcodes

Alternately, you can use the [flexiform] shortcode in content areas. This is especially useful for controlling placement of a form inside existing content., (*13)

Optionally pass a Form Identifier through the ID paramater., (*14)

Some WYSIWYG Content

Default Form: <br /> [FlexiForm]

Explicit Form: <br /> [flexiform id=registration_form]

Templates, Custom Form Classes

By default, flexiform uses Form.ss to render the form. You can change the template by, (*15)

  • Simple Means: Adding a FlexiForm.ss to your theme, (*16)

  • Powerful Means: Provide an alternate form class via $flexiform_form_class, (*17)

class Event extends DataObject
{
    private static $extensions = array(
        'FlexiFormExtension'
    );

    private static $flexi_form_class = 'EventForm';

}

// attempts to use EventForm.ss by default, falling back to Form.ss 
class EventForm extends FlexiForm {

    // optional: provide a specific template
    // public function getTemplate() { return 'EventSpecificTemplate'; } 
}

Configuration

Most configuration is accomplished through the CMS -- however you can further tailor behavior through subclassing (protected properties, getters, and setters) and YAML Configuration., (*18)

See docs/CONFIGURATION.md for documentation and examples., (*19)

The Versions

24/01 2015

dev-master

9999999-dev https://github.com/briceburg/silverstripe-flexiform

Add CMS configurable forms to your SilverStripe objects.

  Sources   Download

BSD-3-Clause

The Requires

 

by Brice Burgess

form cms manage silverstripe sortable gridfield flexi userforms form fields

24/12 2014

0.5.0

0.5.0.0 https://github.com/briceburg/silverstripe-flexiform

Add CMS configurable forms to your SilverStripe objects.

  Sources   Download

BSD-3-Clause

The Requires

 

by Brice Burgess

form cms manage silverstripe sortable gridfield flexi userforms form fields

11/12 2014

0.4.0

0.4.0.0 https://github.com/briceburg/silverstripe-flexiform

Add CMS configurable forms to your SilverStripe objects.

  Sources   Download

BSD-3-Clause

The Requires

 

by Brice Burgess

form cms manage silverstripe sortable gridfield flexi userforms form fields

11/12 2014

dev-mass-refactor

dev-mass-refactor https://github.com/briceburg/silverstripe-flexiform

Add CMS configurable forms to your SilverStripe objects.

  Sources   Download

BSD-3-Clause

The Requires

 

by Brice Burgess

form cms manage silverstripe sortable gridfield flexi userforms form fields

10/12 2014

0.3.0

0.3.0.0 https://github.com/briceburg/silverstripe-flexiform

Add CMS configurable forms to your SilverStripe objects.

  Sources   Download

BSD-3-Clause

The Requires

 

by Brice Burgess

form cms manage silverstripe sortable gridfield flexi userforms form fields

06/12 2014

0.2.1

0.2.1.0 https://github.com/briceburg/silverstripe-flexiform

Add CMS configurable forms to your SilverStripe objects.

  Sources   Download

BSD-3-Clause

The Requires

 

by Brice Burgess

form cms manage silverstripe sortable gridfield flexi userforms form fields

05/12 2014

dev-unique-post-urls

dev-unique-post-urls https://github.com/briceburg/silverstripe-flexiform

Add CMS configurable forms to your SilverStripe objects.

  Sources   Download

BSD-3-Clause

The Requires

 

by Brice Burgess

form cms manage silverstripe sortable gridfield flexi userforms form fields

05/12 2014

0.2.0

0.2.0.0 https://github.com/briceburg/silverstripe-flexiform

Add CMS configurable forms to your SilverStripe objects.

  Sources   Download

BSD-3-Clause

The Requires

 

by Brice Burgess

form cms manage silverstripe sortable gridfield flexi userforms form fields

02/12 2014

0.1.0

0.1.0.0 https://github.com/briceburg/silverstripe-flexiform

Add CMS configurable forms to your SilverStripe objects.

  Sources   Download

BSD-3-Clause

The Requires

 

by Brice Burgess

form cms manage silverstripe sortable gridfield flexi userforms form fields