mirror of
https://github.com/jbcr/core.git
synced 2026-04-29 11:43:14 +02:00
Cast to array in setValue() instead
This commit is contained in:
@@ -32,7 +32,6 @@
|
||||
|
||||
Escaped: <br>
|
||||
<div class="box text_markup_c">{{ record.text_markup|e }}</div><br>
|
||||
|
||||
</p>
|
||||
|
||||
<hr>
|
||||
|
||||
@@ -235,7 +235,7 @@ class ContentEditController extends TwigAwareController
|
||||
$value = Json::findArray($value);
|
||||
}
|
||||
|
||||
$field->setValue((array) $value);
|
||||
$field->setValue($value);
|
||||
}
|
||||
|
||||
private function updateTaxonomy(Content $content, string $key, $taxonomy): void
|
||||
|
||||
@@ -84,7 +84,7 @@ class ContentFixtures extends Fixture implements DependentFixtureInterface
|
||||
$field->setName($name);
|
||||
|
||||
if (isset($preset[$name])) {
|
||||
$field->setValue((array) $preset[$name]);
|
||||
$field->setValue($preset[$name]);
|
||||
} else {
|
||||
$field->setValue($this->getValuesforFieldType($name, $fieldType));
|
||||
}
|
||||
|
||||
@@ -198,9 +198,9 @@ class Field implements Translatable
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function setValue(array $value): self
|
||||
public function setValue($value): self
|
||||
{
|
||||
$this->value = $value;
|
||||
$this->value = (array) $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,8 @@ class MarkdownField extends Field implements Excerptable
|
||||
public function __toString(): string
|
||||
{
|
||||
$markdown = new Markdown();
|
||||
$value = $this->getValue();
|
||||
|
||||
return $markdown->toHtml(implode(', ', $this->getValue()));
|
||||
return $markdown->toHtml(reset($value));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,9 +14,12 @@ use Tightenco\Collect\Support\Collection;
|
||||
*/
|
||||
class SlugField extends Field
|
||||
{
|
||||
public function setValue(array $value): parent
|
||||
public function setValue($value): parent
|
||||
{
|
||||
$value = Str::slug(reset($value));
|
||||
if (is_array($value)) {
|
||||
$value = reset($value);
|
||||
}
|
||||
$value = Str::slug($value);
|
||||
$this->value = [$value];
|
||||
|
||||
return $this;
|
||||
|
||||
Reference in New Issue
Block a user