mirror of
https://github.com/silverstripe/silverstripe-dms
synced 2024-10-22 14:05:56 +02:00
FIX Rename JsonField to DMSJsonField to add a pseudo-namespace
This commit is contained in:
parent
2ddd20cd6c
commit
0ffd4d8584
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Class JsonField combines form inputs into a key-value pair
|
||||
* Combines form inputs into a key-value pair
|
||||
*/
|
||||
class JsonField extends CompositeField
|
||||
class DMSJsonField extends CompositeField
|
||||
{
|
||||
public function __construct($name, $children = null)
|
||||
{
|
||||
@ -90,7 +90,7 @@ class JsonField extends CompositeField
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets
|
||||
* Sets the value
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return $this
|
@ -212,7 +212,7 @@ class DMSDocumentSet extends DataObject
|
||||
$field->setMultiple(true)->setSource($map);
|
||||
}
|
||||
}
|
||||
$keyValPairs = JsonField::create('KeyValuePairs', $dmsDocFields->toArray());
|
||||
$keyValPairs = DMSJsonField::create('KeyValuePairs', $dmsDocFields->toArray());
|
||||
|
||||
// Now lastly add the sort fields
|
||||
$sortedBy = FieldGroup::create('SortedBy', array(
|
||||
|
@ -1,22 +1,22 @@
|
||||
<?php
|
||||
|
||||
class JsonFieldTest extends SapphireTest
|
||||
class DMSJsonFieldTest extends SapphireTest
|
||||
{
|
||||
public function testJsonFieldConstructorMultiWays()
|
||||
{
|
||||
$jsonField = new JsonField('MyJsonField', new FieldList(
|
||||
$jsonField = new DMSJsonField('MyJsonField', new FieldList(
|
||||
new TextField('FirstName', 'Given name'),
|
||||
new TextField('Surname', 'Last name')
|
||||
));
|
||||
$this->assertEquals($jsonField->FieldList()->count(), 2);
|
||||
$this->assertNotNull($jsonField->FieldList()->dataFieldByName('MyJsonField[FirstName]'));
|
||||
|
||||
$jsonField = new JsonField('MyJsonField', array(new TextField('FirstName', 'Given name'),
|
||||
$jsonField = new DMSJsonField('MyJsonField', array(new TextField('FirstName', 'Given name'),
|
||||
new TextField('Surname', 'Last name')));
|
||||
$this->assertEquals($jsonField->FieldList()->count(), 2);
|
||||
$this->assertNotNull($jsonField->FieldList()->dataFieldByName('MyJsonField[FirstName]'));
|
||||
|
||||
$jsonField = new JsonField(
|
||||
$jsonField = new DMSJsonField(
|
||||
'MyJsonField',
|
||||
new TextField('FirstName', 'Given name'),
|
||||
new TextField('Surname', 'Last name')
|
||||
@ -27,7 +27,7 @@ class JsonFieldTest extends SapphireTest
|
||||
|
||||
public function testJsonFieldDataValueCouldDealWithArray()
|
||||
{
|
||||
$jsonField = new JsonField('MyJsonField', new FieldList(
|
||||
$jsonField = new DMSJsonField('MyJsonField', new FieldList(
|
||||
new TextField('FirstName', 'Given name'),
|
||||
new TextField('Surname', 'Last name')
|
||||
));
|
Loading…
Reference in New Issue
Block a user