Refactor form methods to use getValue for retrieving plugin settings
This commit is contained in:
1 parent
6f7e647be1
commit
0225e8ff6a
1 file changed
+7
-7
+7
-7
@@ -27,9 +27,9 @@ class PluginBluditToc extends Plugin {
|
|||||||
public function form() {
|
public function form() {
|
||||||
global $L;
|
global $L;
|
||||||
|
|
||||||
$title = htmlspecialchars($this->getDbField('title'), ENT_QUOTES, 'UTF-8');
|
$title = htmlspecialchars($this->getValue('title'), ENT_QUOTES, 'UTF-8');
|
||||||
$navbarHeight = (int) $this->getDbField('navbarHeight');
|
$navbarHeight = (int) $this->getValue('navbarHeight');
|
||||||
$minWidth = (int) $this->getDbField('minWidth');
|
$minWidth = (int) $this->getValue('minWidth');
|
||||||
|
|
||||||
$h = '';
|
$h = '';
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ class PluginBluditToc extends Plugin {
|
|||||||
* JS will populate <nav id="bltoc-nav"> and mark the container visible.
|
* JS will populate <nav id="bltoc-nav"> and mark the container visible.
|
||||||
*/
|
*/
|
||||||
public function siteBodyBegin() {
|
public function siteBodyBegin() {
|
||||||
$title = htmlspecialchars($this->getDbField('title'), ENT_QUOTES, 'UTF-8');
|
$title = htmlspecialchars($this->getValue('title'), ENT_QUOTES, 'UTF-8');
|
||||||
return '<aside class="bltoc-sidebar" id="bltoc-sidebar" aria-label="' . $title . '">'
|
return '<aside class="bltoc-sidebar" id="bltoc-sidebar" aria-label="' . $title . '">'
|
||||||
. '<div class="bltoc-header"><span class="bltoc-title">' . $title . '</span></div>'
|
. '<div class="bltoc-header"><span class="bltoc-title">' . $title . '</span></div>'
|
||||||
. '<nav id="bltoc-nav" aria-label="' . $title . '"></nav>'
|
. '<nav id="bltoc-nav" aria-label="' . $title . '"></nav>'
|
||||||
@@ -81,9 +81,9 @@ class PluginBluditToc extends Plugin {
|
|||||||
* Config is passed via window.BLTOC so the JS file stays cache-friendly.
|
* Config is passed via window.BLTOC so the JS file stays cache-friendly.
|
||||||
*/
|
*/
|
||||||
public function siteBodyEnd() {
|
public function siteBodyEnd() {
|
||||||
$title = json_encode($this->getDbField('title'));
|
$title = json_encode($this->getValue('title'));
|
||||||
$navbarHeight = (int) $this->getDbField('navbarHeight');
|
$navbarHeight = (int) $this->getValue('navbarHeight');
|
||||||
$minWidth = (int) $this->getDbField('minWidth');
|
$minWidth = (int) $this->getValue('minWidth');
|
||||||
$url = DOMAIN_PLUGINS . $this->directoryName . '/toc.js';
|
$url = DOMAIN_PLUGINS . $this->directoryName . '/toc.js';
|
||||||
|
|
||||||
$out = '<script>window.BLTOC={title:' . $title . ',navbarHeight:' . $navbarHeight . ',minWidth:' . $minWidth . '};</script>' . PHP_EOL;
|
$out = '<script>window.BLTOC={title:' . $title . ',navbarHeight:' . $navbarHeight . ',minWidth:' . $minWidth . '};</script>' . PHP_EOL;
|
||||||
|
|||||||
Reference in new issue
Block a user