addBehavior('adminBlogPreferencesFormV2', function () {
dcCore::app()->blog->settings->addNamespace(initEmailOptionnel::SETTING_NAME);
echo
'
' . __('Optional e-mail address') . '
' .
'
' . form::checkbox(
initEmailOptionnel::SETTING_NAME,
'1',
dcCore::app()->blog->settings->__get(initEmailOptionnel::SETTING_NAME)->enabled ? true : false
) .
'
' .
'
';
});
dcCore::app()->addBehavior('adminBeforeBlogSettingsUpdate', function ($blog_settings) {
dcCore::app()->blog->settings->addNamespace(initEmailOptionnel::SETTING_NAME);
$blog_settings->__get(initEmailOptionnel::SETTING_NAME)->put(
'enabled',
empty($_POST[initEmailOptionnel::SETTING_NAME]) ? false : true,
'boolean',
__('Make e-mail address optional in comments')
);
});