Merge pull request #160 from sminnee/fix-readonly-titlefield
FIX: Fix readonly transformation of field with setTitleField()
This commit is contained in:
commit
3f6af1ab17
|
@ -525,6 +525,8 @@ class TagField extends MultiSelectField
|
||||||
/** @var ReadonlyTagField $copy */
|
/** @var ReadonlyTagField $copy */
|
||||||
$copy = $this->castedCopy(ReadonlyTagField::class);
|
$copy = $this->castedCopy(ReadonlyTagField::class);
|
||||||
$copy->setSourceList($this->getSourceList());
|
$copy->setSourceList($this->getSourceList());
|
||||||
|
$copy->setTitleField($this->getTitleField());
|
||||||
|
|
||||||
return $copy;
|
return $copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -352,6 +352,12 @@ class TagFieldTest extends SapphireTest
|
||||||
$field = new TagField('Tags', '', TagFieldTestBlogTag::get());
|
$field = new TagField('Tags', '', TagFieldTestBlogTag::get());
|
||||||
$readOnlyField = $field->performReadonlyTransformation();
|
$readOnlyField = $field->performReadonlyTransformation();
|
||||||
$this->assertInstanceOf(ReadonlyTagField::class, $readOnlyField);
|
$this->assertInstanceOf(ReadonlyTagField::class, $readOnlyField);
|
||||||
|
|
||||||
|
// Custom title field
|
||||||
|
$field = new TagField('Tags', '', TagFieldTestBlogTag::get());
|
||||||
|
$field->setTitleField('Name');
|
||||||
|
$readOnlyField = $field->performReadonlyTransformation();
|
||||||
|
$this->assertEquals('Name', $readOnlyField->getTitleField());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetSchemaDataDefaults()
|
public function testGetSchemaDataDefaults()
|
||||||
|
|
Loading…
Reference in New Issue