use anonymous function
This commit is contained in:
parent
3fcf139924
commit
8e8ff0370e
1 changed files with 22 additions and 37 deletions
29
_admin.php
29
_admin.php
|
@ -14,27 +14,14 @@ if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
# settings namespace
|
|
||||||
dcCore::app()->blog->settings->addNamespace('saba');
|
|
||||||
|
|
||||||
# widget
|
# widget
|
||||||
require_once __DIR__ . '/_widgets.php';
|
require_once __DIR__ . '/_widgets.php';
|
||||||
|
|
||||||
# behaviors
|
# settings namespace
|
||||||
dcCore::app()->addBehavior(
|
dcCore::app()->blog->settings->addNamespace('saba');
|
||||||
'adminBlogPreferencesFormV2',
|
|
||||||
['adminSaba', 'adminBlogPreferencesForm']
|
|
||||||
);
|
|
||||||
dcCore::app()->addBehavior(
|
|
||||||
'adminBeforeBlogSettingsUpdate',
|
|
||||||
['adminSaba', 'adminBeforeBlogSettingsUpdate']
|
|
||||||
);
|
|
||||||
|
|
||||||
# add settings to admin blog pref page
|
# behaviors
|
||||||
class adminSaba
|
dcCore::app()->addBehavior('adminBlogPreferencesFormV2', function ($blog_settings) {
|
||||||
{
|
|
||||||
public static function adminBlogPreferencesForm($blog_settings)
|
|
||||||
{
|
|
||||||
echo
|
echo
|
||||||
'<div class="fieldset">' .
|
'<div class="fieldset">' .
|
||||||
'<h4 id="saba_params">' . __('Search Across Blog Archive') . '</h4>' .
|
'<h4 id="saba_params">' . __('Search Across Blog Archive') . '</h4>' .
|
||||||
|
@ -48,11 +35,9 @@ class adminSaba
|
||||||
__('This suggests visitors some posts on page 404.') .
|
__('This suggests visitors some posts on page 404.') .
|
||||||
'</p>' .
|
'</p>' .
|
||||||
'</div>';
|
'</div>';
|
||||||
}
|
});
|
||||||
|
|
||||||
public static function adminBeforeBlogSettingsUpdate($blog_settings)
|
dcCore::app()->addBehavior('adminBeforeBlogSettingsUpdate', function ($blog_settings) {
|
||||||
{
|
|
||||||
$blog_settings->saba->put('active', !empty($_POST['saba_active']));
|
$blog_settings->saba->put('active', !empty($_POST['saba_active']));
|
||||||
$blog_settings->saba->put('error', !empty($_POST['saba_error']));
|
$blog_settings->saba->put('error', !empty($_POST['saba_error']));
|
||||||
}
|
});
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue