Prefer local data to parent data (attempt 2)

There was some confusion during the code review of
4dbe4076d6

In the case of array_merge, anything defined as the second parameter
with the same key as the first will override the data in the first. This
means the current situation is that parent data replaces any local data.

However, we want the local data to be preferred.
Specifically, the call to  $this->getFooterData() must override
the data set parent::getTemplateData. This is not happening with the current
ordering.

Without this change, Ib2af1f72c0508870b20321dffc8af2158d0dbd55
will result in the footer not rendering.

Bug: T262730
Change-Id: Iaf701c054314f210e40a82b5277e9914edccc493
This commit is contained in:
jdlrobson 2020-09-29 10:41:39 -07:00 committed by Jdlrobson
parent 711a41812a
commit c0ccbcb6f8
1 changed files with 2 additions and 2 deletions

View File

@ -123,7 +123,7 @@ class SkinVector extends SkinMustache {
$parentData = parent::getTemplateData();
$commonSkinData = array_merge( [
$commonSkinData = array_merge( $parentData, [
'page-langcode' => $title->getPageViewLanguage()->getHtmlCode(),
'page-isarticle' => (bool)$out->isArticle(),
@ -142,7 +142,7 @@ class SkinVector extends SkinMustache {
'data-sidebar' => $this->getTemplateDataSidebar(),
'sidebar-visible' => $this->isSidebarVisible(),
], $parentData, $this->getMenuProps() );
], $this->getMenuProps() );
if ( $skin->getUser()->isLoggedIn() ) {
// Note: This data is also passed to legacy template where it is unused.