Skip to content

Commit

Permalink
Re-vendor framework 3.x compatible version as 2.0.x-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Damian Mooyman committed Aug 28, 2017
1 parent 3b9f19d commit 96f7116
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 25 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2010, SilverStripe Australia.
Copyright (c) 2010, Symbiote.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
# SilverStripe MultiValueField module

[![Build Status](https://travis-ci.org/silverstripe-australia/silverstripe-multivaluefield.svg?branch=master)](https://travis-ci.org/silverstripe-australia/silverstripe-multivaluefield)
[![Build Status](https://travis-ci.org/symbiote/silverstripe-multivaluefield.svg?branch=master)](https://travis-ci.org/symbiote/silverstripe-multivaluefield)

Note: The SilverStripe 2.4 compatible version of the module is still available
in the ss24 branch

A database field type that allows the storage of multiple discrete values in
a single database field. This also provides form fields for entering multiple
a single database field. This also provides form fields for entering multiple
values in a simple manner

* MultiValueTextField - displays a text field. When data is entered, another
text field is displayed directly beneath. Subsequent data entry triggers
more text fields to appear
* MultiValueDropdownField - displays a dropdown field. When a value is selected
another dropdown field is displayed.
another dropdown field is displayed.

Within templates, the field can be iterated over as per a data object set.
The property $Value is available as a Varchar type, and other typical
Within templates, the field can be iterated over as per a data object set.
The property $Value is available as a Varchar type, and other typical
properties such as $FirstLast etc are inherited from ViewableData.

Data is stored in the database in a serialized PHP format. While this is not
ideal for searching purposes, some external indexing engines (eg the Solr
module) are aware of the field type and will index accordingly.
ideal for searching purposes, some external indexing engines (eg the Solr
module) are aware of the field type and will index accordingly.

## Version info

Version marked as 2.0.x are compatible with SilverStripe 3.1, with 2.0.1 compatible with 3.1.1.

* [SilverStripe 3.0 compatible version](https://github.com/silverstripe-australia/silverstripe-multivaluefield/tree/1.0)
* [SilverStripe 2.4 compatible version](https://github.com/silverstripe-australia/silverstripe-multivaluefield/tree/ss24)
* [SilverStripe 3.0 compatible version](https://github.com/symbiote/silverstripe-multivaluefield/tree/1.0)
* [SilverStripe 2.4 compatible version](https://github.com/symbiote/silverstripe-multivaluefield/tree/ss24)


## Basic Usage
Expand All @@ -53,12 +53,12 @@ To make use of the field on the frontend, you can loop over the Items property

In this case, `$Value` is a Varchar object, so you can call all relevant string field methods on it, such as `$Value.Raw`, `$Value.LimitWordCount` etc etc.

Note that to have the `$Key` value available as something other than an integer, use the `KeyValueField` field type to populate the field.
Note that to have the `$Key` value available as something other than an integer, use the `KeyValueField` field type to populate the field.


## Maintainer Contacts

* Marcus Nyeholt <marcus@silverstripe.com.au>
* Marcus Nyeholt <marcus@symbiote.com.au>

## Requirements

Expand Down
2 changes: 1 addition & 1 deletion code/fields/KeyValueField.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* A field that lets you specify both a key AND a value for each row entry
*
* @author Marcus Nyeholt <marcus@silverstripe.com.au>
* @author Marcus Nyeholt <marcus@symbiote.com.au>
*/
class KeyValueField extends MultiValueTextField {
protected $sourceKeys;
Expand Down
2 changes: 1 addition & 1 deletion code/fields/MultiValueCheckboxField.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* A checkboxset that uses a multivalue field for key / val pairs
*
* @author marcus@silverstripe.com.au
* @author marcus@symbiote.com.au
* @license BSD License http://silverstripe.org/bsd-license/
*/
class MultiValueCheckboxField extends CheckboxSetField {
Expand Down
4 changes: 2 additions & 2 deletions code/fields/MultiValueDropdownField.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* A multivalued field that uses dropdown boxes for selecting the value for each
*
* @author Marcus Nyeholt <marcus@silverstripe.com.au>
* @author Marcus Nyeholt <marcus@symbiote.com.au>
*/
class MultiValueDropdownField extends MultiValueTextField {
protected $source;
Expand Down Expand Up @@ -95,4 +95,4 @@ protected function createSelectList($number, $name, $values, $selected = '') {

return self::create_tag('select', $attrs, $options);
}
}
}
4 changes: 2 additions & 2 deletions code/fields/MultiValueField.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* A DB field that serialises an array before writing it to the db, and returning the array
* back to the end user.
*
* @author Marcus Nyeholt <marcus@silverstripe.com.au>
* @author Marcus Nyeholt <marcus@symbiote.com.au>
*/
class MultiValueField extends DBField implements CompositeDBField {
protected $changed = false;
Expand Down Expand Up @@ -150,7 +150,7 @@ public function csv() {
public function Implode($separator = ', ') {
return implode($separator, $this->getValue());
}

public function __toString() {
if ($this->getValue()) {
return $this->csv();
Expand Down
4 changes: 2 additions & 2 deletions code/fields/MultiValueListField.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* A multivalued field that uses a multi choice select box for selecting the value
*
* @author Marcus Nyeholt <marcus@silverstripe.com.au>
* @author Marcus Nyeholt <marcus@symbiote.com.au>
*/
class MultiValueListField extends MultiValueTextField {
protected $source;
Expand Down Expand Up @@ -45,4 +45,4 @@ public function Field($properties = array()) {

return self::create_tag('select', $attrs, $options);
}
}
}
4 changes: 2 additions & 2 deletions code/fields/MultiValueTextField.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* A text field for multivalued text entry
*
* @author Marcus Nyeholt <marcus@silverstripe.com.au>
* @author Marcus Nyeholt <marcus@symbiote.com.au>
*/
class MultiValueTextField extends FormField {

Expand Down Expand Up @@ -93,4 +93,4 @@ public function setTag($tag) {
return $this;
}

}
}
13 changes: 11 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
{
"name": "silverstripe/multivaluefield",
"name": "symbiote/silverstripe-multivaluefield",
"description": "A DB field + form fields for storing multiple values in a single property (serialized).",
"type": "silverstripe-module",
"keywords": ["silverstripe", "formfield", "dbfield"],
"license": "BSD-3-Clause",
"authors": [
{
"name": "Marcus Nyeholt",
"email": "marcus@silverstripe.com.au"
"email": "marcus@symbiote.com.au"
}
],
"require": {
"silverstripe/framework": "~3.1"
},
"extra": {
"installer-name": "multivaluefield",
"branch-alias": {
"3.x-dev": "3.0.x-dev"
}
},
"replace": {
"silverstripe/multivaluefield": "self.version"
}
}
2 changes: 1 addition & 1 deletion tests/MultiValueFieldTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* @author Marcus Nyeholt <marcus@silverstripe.com.au>
* @author Marcus Nyeholt <marcus@symbiote.com.au>
*/
class MultiValueFieldTest extends SapphireTest {

Expand Down

0 comments on commit 96f7116

Please sign in to comment.