fix unknown model on first use

This commit is contained in:
Jean-Christian Denis 2023-04-12 10:35:03 +02:00
parent f304f15d87
commit 6a87e4c5ff
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951
2 changed files with 3 additions and 0 deletions

View file

@ -115,9 +115,11 @@ class Manage extends dcNsProcess
$models = iterator_to_array($models);
$s = dcCore::app()->blog->settings->get(My::id());
$model = json_decode((string) $s->get('model'), true);
$model = array_merge(My::defaultModel(), is_array($model) ? $model : []);
$header = '';
foreach ($models as $m) {
$m = array_merge(My::defaultModel(), $m);
$header .= "\t" .
'arlequin.addModel(' .
'"' . Html::escapeJS($m['name']) . '",' .

View file

@ -85,6 +85,7 @@ class My
public static function defaultModel(): array
{
return [
'name' => __('Default'),
'e_html' => '<li><a href="%1$s%2$s%3$s">%4$s</a></li>',
'a_html' => '<li><strong>%4$s</strong></li>',
's_html' => '<ul>%2$s</ul>',