summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Beaver <sbeaver@netgate.com>2017-06-01 08:56:18 -0400
committerSteve Beaver <sbeaver@netgate.com>2017-06-01 08:58:46 -0400
commitde88f4218ccefafaea971241813468c106083138 (patch)
treefc958eb632b213a8f01c5f097579116d095c322a
parent63cbb6551bf3ec7c72a49e148f68fa6ac0ae85b5 (diff)
downloadpfsense-de88f4218ccefafaea971241813468c106083138.zip
pfsense-de88f4218ccefafaea971241813468c106083138.tar.gz
Use the section ID as an anchor so that hyperlinks can jump directly to that sectiom
e.g.: $section = new Form_Section("My section", "a_here"); then: https://firewall/system_somepage.php#a_here
-rw-r--r--src/usr/local/www/classes/Form/Section.class.php23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/usr/local/www/classes/Form/Section.class.php b/src/usr/local/www/classes/Form/Section.class.php
index a14494f..c91bf31 100644
--- a/src/usr/local/www/classes/Form/Section.class.php
+++ b/src/usr/local/www/classes/Form/Section.class.php
@@ -94,14 +94,15 @@ class Form_Section extends Form_Element
$body = implode('', $this->_groups);
$hdricon = "";
$bodyclass = '<div class="panel-body">';
+ $id = $this->_attributes['id'];
if ($this->_collapsible & COLLAPSIBLE) {
$hdricon = '<span class="widget-heading-icon">' .
- '<a data-toggle="collapse" href="#' . $this->_attributes['id'] . '_panel-body">' .
+ '<a data-toggle="collapse" href="#' . $id . '_panel-body">' .
'<i class="fa fa-plus-circle"></i>' .
'</a>' .
'</span>';
- $bodyclass = '<div id="' . $this->_attributes['id'] . '_panel-body" class="panel-body collapse ';
+ $bodyclass = '<div id="' . $id . '_panel-body" class="panel-body collapse ';
if (($this->_collapsible & SEC_CLOSED)) {
$bodyclass .= 'out">';
} else {
@@ -117,7 +118,7 @@ class Form_Section extends Form_Element
</div>
</div>
EOT;
- } else {
+ } else if ($id == "") {
return <<<EOT2
{$element}
<div class="panel-heading">
@@ -128,6 +129,20 @@ EOT;
</div>
</div>
EOT2;
- }
+ } else {
+ // If an ID has been specified for this section, include an anchor tag in the header to that hrefs can
+ // jump directly to it
+
+ return <<<EOT3
+ {$element}
+ <div class="panel-heading">
+ <h2 class="panel-title"><a name="{$id}">{$title}{$hdricon}</a></h2>
+ </div>
+ {$bodyclass}
+ {$body}
+ </div>
+ </div>
+EOT3;
+ }
}
}
OpenPOWER on IntegriCloud