mirror of
https://github.com/flarum/core.git
synced 2025-07-25 10:41:24 +02:00
Add Custom Footer HTML (#1315)
* Add Custom Footer HTML Straight copy from Custom Header HTML * Move Custom Footer HTML to exactly before `</body>` tag. * Fix invalid class name * Append CustomFooterHTML when preparing the view. * Some consistency in placing the variable
This commit is contained in:
@@ -3,6 +3,7 @@ import Button from 'flarum/components/Button';
|
|||||||
import Switch from 'flarum/components/Switch';
|
import Switch from 'flarum/components/Switch';
|
||||||
import EditCustomCssModal from 'flarum/components/EditCustomCssModal';
|
import EditCustomCssModal from 'flarum/components/EditCustomCssModal';
|
||||||
import EditCustomHeaderModal from 'flarum/components/EditCustomHeaderModal';
|
import EditCustomHeaderModal from 'flarum/components/EditCustomHeaderModal';
|
||||||
|
import EditCustomFooterModal from 'flarum/components/EditCustomFooterModal';
|
||||||
import UploadImageButton from 'flarum/components/UploadImageButton';
|
import UploadImageButton from 'flarum/components/UploadImageButton';
|
||||||
import saveSettings from 'flarum/utils/saveSettings';
|
import saveSettings from 'flarum/utils/saveSettings';
|
||||||
|
|
||||||
@@ -81,6 +82,18 @@ export default class AppearancePage extends Page {
|
|||||||
})}
|
})}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
<legend>{app.translator.trans('core.admin.appearance.custom_footer_heading')}</legend>
|
||||||
|
<div className="helpText">
|
||||||
|
{app.translator.trans('core.admin.appearance.custom_footer_text')}
|
||||||
|
</div>
|
||||||
|
{Button.component({
|
||||||
|
className: 'Button',
|
||||||
|
children: app.translator.trans('core.admin.appearance.edit_footer_button'),
|
||||||
|
onclick: () => app.modal.show(new EditCustomFooterModal())
|
||||||
|
})}
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{app.translator.trans('core.admin.appearance.custom_styles_heading')}</legend>
|
<legend>{app.translator.trans('core.admin.appearance.custom_styles_heading')}</legend>
|
||||||
<div className="helpText">
|
<div className="helpText">
|
||||||
|
@@ -0,0 +1,24 @@
|
|||||||
|
import SettingsModal from 'flarum/components/SettingsModal';
|
||||||
|
|
||||||
|
export default class EditCustomFooterModal extends SettingsModal {
|
||||||
|
className() {
|
||||||
|
return 'EditCustomFooterModal Modal--large';
|
||||||
|
}
|
||||||
|
|
||||||
|
title() {
|
||||||
|
return app.translator.trans('core.admin.edit_footer.title');
|
||||||
|
}
|
||||||
|
|
||||||
|
form() {
|
||||||
|
return [
|
||||||
|
<p>{app.translator.trans('core.admin.edit_footer.customize_text')}</p>,
|
||||||
|
<div className="Form-group">
|
||||||
|
<textarea className="FormControl" rows="30" bidi={this.setting('custom_footer')}/>
|
||||||
|
</div>
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
onsaved() {
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
|
}
|
@@ -77,6 +77,7 @@ class ForumSerializer extends AbstractSerializer
|
|||||||
'logoUrl' => $this->getLogoUrl(),
|
'logoUrl' => $this->getLogoUrl(),
|
||||||
'faviconUrl' => $this->getFaviconUrl(),
|
'faviconUrl' => $this->getFaviconUrl(),
|
||||||
'headerHtml' => $this->settings->get('custom_header'),
|
'headerHtml' => $this->settings->get('custom_header'),
|
||||||
|
'footerHtml' => $this->settings->get('custom_footer'),
|
||||||
'allowSignUp' => (bool) $this->settings->get('allow_sign_up'),
|
'allowSignUp' => (bool) $this->settings->get('allow_sign_up'),
|
||||||
'defaultRoute' => $this->settings->get('default_route'),
|
'defaultRoute' => $this->settings->get('default_route'),
|
||||||
'canViewDiscussions' => $this->actor->can('viewDiscussions'),
|
'canViewDiscussions' => $this->actor->can('viewDiscussions'),
|
||||||
|
@@ -304,7 +304,7 @@ class FrontendView
|
|||||||
$view->jsUrls = $this->buildJsUrls($baseUrl);
|
$view->jsUrls = $this->buildJsUrls($baseUrl);
|
||||||
|
|
||||||
$view->head = $this->buildHeadContent();
|
$view->head = $this->buildHeadContent();
|
||||||
$view->foot = implode("\n", $this->foot);
|
$view->foot = $this->buildFootContent(array_get($forum, 'data.attributes.footerHtml'));
|
||||||
|
|
||||||
return $view->render();
|
return $view->render();
|
||||||
}
|
}
|
||||||
@@ -380,6 +380,15 @@ class FrontendView
|
|||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function buildFootContent($customFooterHtml)
|
||||||
|
{
|
||||||
|
$html = implode("\n", $this->foot);
|
||||||
|
|
||||||
|
$html .= $customFooterHtml;
|
||||||
|
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return CompilerInterface
|
* @return CompilerInterface
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user