[refactor] encapsulate footer data in single function

Move the VectorBeforeFooter hook code into its own function
This adds consistency with the getMenuData function.

Change-Id: I6483fd200747852246e9cc587f57b1a21a2f0a44
This commit is contained in:
jdlrobson 2020-06-15 14:45:16 -07:00 committed by Jdlrobson
parent 16abb4ff84
commit a6940fe355
1 changed files with 13 additions and 11 deletions

View File

@ -122,11 +122,6 @@ class VectorTemplate extends BaseTemplate {
$out = $skin->getOutput(); $out = $skin->getOutput();
$title = $out->getTitle(); $title = $out->getTitle();
ob_start();
Hooks::run( 'VectorBeforeFooter', [], '1.35' );
$htmlHookVectorBeforeFooter = ob_get_contents();
ob_end_clean();
// Naming conventions for Mustache parameters. // Naming conventions for Mustache parameters.
// //
// Value type (first segment): // Value type (first segment):
@ -163,10 +158,7 @@ class VectorTemplate extends BaseTemplate {
'html-printfooter' => $skin->printSource(), 'html-printfooter' => $skin->printSource(),
'html-catlinks' => $skin->getCategories(), 'html-catlinks' => $skin->getCategories(),
'data-footer' => [ 'data-footer' => $this->getFooterData(),
'html-hook-vector-before-footer' => $htmlHookVectorBeforeFooter,
'array-footer-rows' => $this->getTemplateFooterRows(),
],
'html-navigation-heading' => $this->msg( 'navigation-heading' ), 'html-navigation-heading' => $this->msg( 'navigation-heading' ),
'data-search-box' => $this->buildSearchProps(), 'data-search-box' => $this->buildSearchProps(),
@ -211,7 +203,7 @@ class VectorTemplate extends BaseTemplate {
* Get rows that make up the footer * Get rows that make up the footer
* @return array for use in Mustache template describing the footer elements. * @return array for use in Mustache template describing the footer elements.
*/ */
private function getTemplateFooterRows() : array { private function getFooterData() : array {
$skin = $this->getSkin(); $skin = $this->getSkin();
$footerRows = []; $footerRows = [];
foreach ( $this->getFooterLinks() as $category => $links ) { foreach ( $this->getFooterLinks() as $category => $links ) {
@ -254,7 +246,17 @@ class VectorTemplate extends BaseTemplate {
]; ];
} }
return $footerRows; ob_start();
Hooks::run( 'VectorBeforeFooter', [], '1.35' );
$htmlHookVectorBeforeFooter = ob_get_contents();
ob_end_clean();
$data = [
'html-hook-vector-before-footer' => $htmlHookVectorBeforeFooter,
'array-footer-rows' => $footerRows,
];
return $data;
} }
/** /**