Skip to content

Commit

Permalink
API Rename FormField Value to getFormattedValue
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Jan 14, 2025
1 parent 11a8402 commit 55cda76
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/StringTagField.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public function getSchemaDataDefaults()
'lazyLoad' => $this->getShouldLazyLoad(),
'creatable' => $this->getCanCreate(),
'multi' => $this->getIsMultiple(),
'value' => $this->formatOptions($this->Value()),
'value' => $this->formatOptions($this->getValue()),
'disabled' => $this->isDisabled() || $this->isReadonly(),
]
);
Expand Down Expand Up @@ -384,7 +384,7 @@ public function setCanCreate($canCreate)
public function performReadonlyTransformation()
{
$field = parent::performReadonlyTransformation();
$field->setValue(implode(', ', $this->Value()));
$field->setValue(implode(', ', $this->getValue()));
return $field;
}
}
6 changes: 3 additions & 3 deletions tests/StringTagFieldTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,18 +140,18 @@ public function testPerformReadonlyTransformation()
// Ensure a single value can be rendered
$field->setValue(['Test2']);
$field_readonly = $field->performReadonlyTransformation();
$this->assertEquals('Test2', $field_readonly->Value());
$this->assertEquals('Test2', $field_readonly->getValue());

// Ensure multiple valid values are rendered
$field->setValue(['Test1', 'Test2']);
$field_readonly = $field->performReadonlyTransformation();
$this->assertEquals('Test1, Test2', $field_readonly->Value());
$this->assertEquals('Test1, Test2', $field_readonly->getValue());

// Ensure an value not in the source array is still rendered
// (because e.g. in history view it must have been a valid value when it was set)
$field->setValue(['Test', 'Test1']);
$field_readonly = $field->performReadonlyTransformation();
$this->assertEquals('Test, Test1', $field_readonly->Value());
$this->assertEquals('Test, Test1', $field_readonly->getValue());
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/TagFieldTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ public function testItDisplaysValuesFromRelations()

$ids = TagFieldTestBlogTag::get()->column('ID');

$this->assertEquals($field->Value(), $ids);
$this->assertEquals($field->getValue(), $ids);
}

public function testItIgnoresNewTagsIfCannotCreate()
Expand Down

0 comments on commit 55cda76

Please sign in to comment.