Skip to content

Commit

Permalink
fix for groups mode
Browse files Browse the repository at this point in the history
  • Loading branch information
mjauvin committed Feb 23, 2024
1 parent 533285a commit 1813c85
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
13 changes: 12 additions & 1 deletion formwidgets/MLRepeater.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ public function init()
{
$this->fillFromConfig(['translationMode']);
// make the translationMode available to the repeater items formwidgets
$this->config->form['translationMode'] = $this->translationMode;
if (isset($this->config->form)) {
$this->config->form['translationMode'] = $this->translationMode;
}

parent::init();
$this->initLocale();
Expand Down Expand Up @@ -77,6 +79,15 @@ public function prepareVars()
$this->prepareLocaleVars();
}

// make the translationMode available to the repeater groups formwidgets
protected function getGroupFormFieldConfig($code)
{
$config = parent::getGroupFormFieldConfig($code);
$config['translationMode'] = $this->translationMode;

return $config;
}

/**
* Returns an array of translated values for this field
* @return array
Expand Down
5 changes: 4 additions & 1 deletion traits/MLControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,10 @@ public function isFieldParentJsonable()
// $names[0] is the Model, $names[1] is the top array name
$arrayName = $names[1];

if (method_exists($this->model, 'isJsonable') && $this->model->isJsonable($arrayName)) {
if ($this->model->isClassExtendedWith('System\Behaviors\SettingsModel') ||
method_exists($this->model, 'isJsonable') && $this->model->isJsonable($arrayName)
)
{
return true;
}
}
Expand Down

0 comments on commit 1813c85

Please sign in to comment.