mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Support booleans in SilverStripe\View\Parsers\Diff::getHTMLChunks
Convert booleans to strings ("true", "false") so they can be diff'd for display.
This commit is contained in:
parent
b8c3bf6fa5
commit
9d77537061
@ -161,15 +161,20 @@ class Diff extends \Diff
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|array $content If passed as an array, values will be concatenated with a comma.
|
||||
* @param string|bool|array $content If passed as an array, values will be concatenated with a comma.
|
||||
* @return array
|
||||
*/
|
||||
public static function getHTMLChunks($content)
|
||||
{
|
||||
if ($content && !is_string($content) && !is_array($content) && !is_numeric($content)) {
|
||||
if ($content && !is_string($content) && !is_array($content) && !is_numeric($content) && !is_bool($content)) {
|
||||
throw new InvalidArgumentException('$content parameter needs to be a string or array');
|
||||
}
|
||||
if (is_bool($content)) {
|
||||
// Convert boolean to strings
|
||||
$content = $content ? "true" : "false";
|
||||
}
|
||||
if (is_array($content)) {
|
||||
// Convert array to CSV
|
||||
$content = implode(',', $content);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user