2017 © Pedro Peláez
 

silverstripe-module quickaddnew

A decorator for form fields that manage object relationships, to allow adding a new object on the fly through a dialog window. It can handle has_one, has_many or many_many relationships. At the moment it has been tested / works on DropdownField and ListboxField. It works both in the CMS and in the frontend.

image

sheadawson/quickaddnew

A decorator for form fields that manage object relationships, to allow adding a new object on the fly through a dialog window. It can handle has_one, has_many or many_many relationships. At the moment it has been tested / works on DropdownField and ListboxField. It works both in the CMS and in the frontend.

  • Tuesday, June 20, 2017
  • by sheadawson
  • Repository
  • 6 Watchers
  • 39 Stars
  • 28,449 Installations
  • PHP
  • 11 Dependents
  • 1 Suggesters
  • 18 Forks
  • 5 Open issues
  • 10 Versions
  • 3 % Grown

The README.md

silverstripe-quickaddnew

What is it?

A decorator for form fields that manage object relationships, to allow adding a new object on the fly through a dialog window. It can handle has_one, has_many or many_many relationships. At the moment it has been tested / works on DropdownField, ListboxField and CheckboxSetField. It works both in the CMS and in the frontend. For frontend, Select2Field or MultiSelect2Field are recommended., (*1)

Screenshot

Screenshot, (*2)

Requirements

SilverStripe 3, (*3)

Usage

Firstly, when creating the form field, we need to create a closure that returns the source array to populate the field's options. We do this because later on, when the field is refreshed with the newly created Object ID as it's value, we need to use this function Again to get up to date data for the source., (*4)

$source = function(){
    return MyObject::get()->map()->toArray();
};

Then we can create the form field, calling the closure as the source argument, (*5)

$field = DropdownField::create('MyObjectID', 'My Object', $source());

Next, we can tell the field to use and configure quickaddnew. The first parameter is the class name of the object that will be created. The second is the $source closure Note: See QuickAddNewExtension::useAddNew() for the list of configurations parameters available. These allow you to customise the fields and required fields (for validation) for the dialog. By default the object class's getAddNewFields() or getCMSFields() methods are used, (*6)

$field->useAddNew('MyObject', $source);

Add the field to your FieldList, (*7)

$fields->addFieldToTab('Root.Main', $field);

The Versions

20/06 2017

1.1.x-dev

1.1.9999999.9999999-dev http://github.com/sheadawson/silverstripe-quickaddnew

A decorator for form fields that manage object relationships, to allow adding a new object on the fly through a dialog window. It can handle has_one, has_many or many_many relationships. At the moment it has been tested / works on DropdownField and ListboxField. It works both in the CMS and in the frontend.

  Sources   Download

The Requires

 

by Shea Dawson

silverstripe forms

20/06 2017

dev-master

9999999-dev http://github.com/sheadawson/silverstripe-quickaddnew

A decorator for form fields that manage object relationships, to allow adding a new object on the fly through a dialog window. It can handle has_one, has_many or many_many relationships. At the moment it has been tested / works on DropdownField and ListboxField. It works both in the CMS and in the frontend.

  Sources   Download

The Requires

 

by Shea Dawson

silverstripe forms

20/06 2017

1.1.4

1.1.4.0 http://github.com/sheadawson/silverstripe-quickaddnew

A decorator for form fields that manage object relationships, to allow adding a new object on the fly through a dialog window. It can handle has_one, has_many or many_many relationships. At the moment it has been tested / works on DropdownField and ListboxField. It works both in the CMS and in the frontend.

  Sources   Download

The Requires

 

by Shea Dawson

silverstripe forms

14/10 2016

1.1.3

1.1.3.0 http://github.com/sheadawson/silverstripe-quickaddnew

A decorator for form fields that manage object relationships, to allow adding a new object on the fly through a dialog window. It can handle has_one, has_many or many_many relationships. At the moment it has been tested / works on DropdownField and ListboxField. It works both in the CMS and in the frontend.

  Sources   Download

The Requires

 

by Shea Dawson

silverstripe forms

06/07 2015

1.1.2

1.1.2.0 http://github.com/sheadawson/silverstripe-quickaddnew

A decorator for form fields that manage object relationships, to allow adding a new object on the fly through a dialog window. It can handle has_one, has_many or many_many relationships. At the moment it has been tested / works on DropdownField and ListboxField. It works both in the CMS and in the frontend.

  Sources   Download

The Requires

 

by Shea Dawson

silverstripe forms

10/02 2015

1.1.1

1.1.1.0 http://github.com/sheadawson/silverstripe-quickaddnew

A decorator for form fields that manage object relationships, to allow adding a new object on the fly through a dialog window. It can handle has_one, has_many or many_many relationships. At the moment it has been tested / works on DropdownField and ListboxField. It works both in the CMS and in the frontend.

  Sources   Download

The Requires

 

by Shea Dawson

silverstripe forms

08/10 2014

1.1

1.1.0.0 http://github.com/sheadawson/silverstripe-quickaddnew

A decorator for form fields that manage object relationships, to allow adding a new object on the fly through a dialog window. It can handle has_one, has_many or many_many relationships. At the moment it has been tested / works on DropdownField and ListboxField. It works both in the CMS and in the frontend.

  Sources   Download

The Requires

 

by Shea Dawson

silverstripe forms

04/09 2013

1.0.1

1.0.1.0 http://github.com/sheadawson/silverstripe-quickaddnew

A decorator for form fields that manage object relationships, to allow adding a new object on the fly through a dialog window. It can handle has_one, has_many or many_many relationships. At the moment it has been tested / works on DropdownField and ListboxField. It works both in the CMS and in the frontend.

  Sources   Download

The Requires

 

by Shea Dawson

silverstripe forms

26/08 2013

1.0

1.0.0.0 http://github.com/sheadawson/silverstripe-quickaddnew

A decorator for form fields that manage object relationships, to allow adding a new object on the fly through a dialog window. It can handle has_one, has_many or many_many relationships. At the moment it has been tested / works on DropdownField and ListboxField. It works both in the CMS and in the frontend.

  Sources   Download

The Requires

 

by Shea Dawson

silverstripe forms

13/11 2012

0.1.0

0.1.0.0 http://github.com/sheadawson/silverstripe-quickaddnew

A decorator for form fields that manage object relationships, to allow adding a new object on the fly through a dialog window. It can handle has_one, has_many or many_many relationships. At the moment it has been tested / works on DropdownField and ListboxField. It works both in the CMS and in the frontend.

  Sources   Download

The Requires

 

by Shea Dawson

silverstripe forms