use page title as default in widget

master
Jean-Christian Paul Denis 2023-01-04 00:50:34 +01:00
parent 6160c2125a
commit fd210890b5
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
2 changed files with 7 additions and 7 deletions

View File

@ -37,13 +37,13 @@ dcCore::app()->addBehaviors([
]);
},
'adminSimpleMenuAddType' => function (ArrayObject $items) {
$items[basename(__DIR__)] = new ArrayObject([__('Comments list'), false]);
$items[basename(__DIR__)] = new ArrayObject([__('Comments list'), false]);
},
'adminSimpleMenuBeforeEdit' => function ($type, $select, &$item) {
if (basename(__DIR__) == $type) {
if (basename(__DIR__) == $type) {
$item[0] = __('Comments list');
$item[1] = __('Comments list');
$item[1] = dcCore::app()->blog->settings->get(basename(__DIR__))->get('page_title') ?? __('Comments list');
$item[2] = dcCore::app()->admin->blog_url . dcCore::app()->url->getURLFor(basename(__DIR__));
}
}
},
]);

View File

@ -25,12 +25,12 @@ class comListeWidget
__('Comments list'),
['comListeWidget','publicWidget'],
null,
__('Comments list')
__('Link to comments list public page')
)
->addTitle(__('Comments list'))
->setting(
'link_title',
__('Link title:'),
__('Link title: (leave empty to use page title'),
__('Comments list')
)
->addHomeOnly()
@ -56,7 +56,7 @@ class comListeWidget
sprintf(
'<p><a href="%s">%s</a></p>',
dcCore::app()->blog->url . dcCore::app()->url->getBase('comListe'),
$w->link_title ? html::escapeHTML($w->link_title) : __('Comments list')
$w->link_title ? html::escapeHTML($w->link_title) : (dcCore::app()->blog->settings->get(basename(__DIR__))->get('page_title') ?? __('Comments list'))
)
);
}