public function getDatabaseType()
{
- if ($this->_translatable) {
+ if ($this->getAttribute('translatable')) {
return 'text';
}
return $this->_databaseType;
'default' => '0',
'label' => __('Status'),
'options' => ['0' => __('Offline'), '1' => __('Published')],
+ 'translatable' => true,
'tab' => 'Informations principales',
]);
$this->_seo();
return;
}
foreach ($fields as $field) {
- $this->addFakeField($field);
+ $attr = array_merge($this->defaultFieldAttributes, $field);
+
+ $this->addFakeField($attr);
}
$controller->updateFieldsFromModel();
if (!in_array($store_in, $this->fillable)) {
$this->fillable[] = $store_in;
}
- if (!isset($this->casts[$store_in])) {
- $this->casts[$store_in] = 'array';
+
+ $this->casts[$store_in] = 'array';
+
+ if ($field->getAttribute('translatable')) {
+ $this->fillable[] = $store_in;
+ $this->translatable[] = $store_in;
}
- $this->fakeColumns[$store_in] = true;
+ $this->fakeColumns[] = $store_in;
} else {
if ($field->getAttribute('fillable')) {
$this->fillable[] = $name;
if ($field->getAttribute('hidden')) {
$this->hidden[] = $name;
}
- if ($field->getAttribute('translatable')) {
- $this->translatable[] = $name;
- }
if ($field->getAttribute('cast', false) !== false) {
$this->casts[$field->getAttribute('name')] = $field->getAttribute('cast');
}
}
}
+ if ($field->getAttribute('translatable')) {
+ $this->translatable[] = $name;
+ }
+
}