[MediaWiki-commits] [Gerrit] mediawiki...BlueSpiceFoundation[master]: Hook/SkinTemplateOutputPageBeforeExec: 2 new functions to ap...
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/405862 ) Change subject: Hook/SkinTemplateOutputPageBeforeExec: 2 new functions to append/merge .. Hook/SkinTemplateOutputPageBeforeExec: 2 new functions to append/merge fields in $template->data array These fiels are used to provide data for BlueSpiceSkin. The functions prevent notice if field is not definded before setting an value. Change-Id: Ic4e235be04d65edfe99f544b44e6fef671a35e40 --- M src/Hook/SkinTemplateOutputPageBeforeExec.php 1 file changed, 28 insertions(+), 0 deletions(-) Approvals: Pwirth: Looks good to me, approved jenkins-bot: Verified diff --git a/src/Hook/SkinTemplateOutputPageBeforeExec.php b/src/Hook/SkinTemplateOutputPageBeforeExec.php index 3cee34b..649f60d 100644 --- a/src/Hook/SkinTemplateOutputPageBeforeExec.php +++ b/src/Hook/SkinTemplateOutputPageBeforeExec.php @@ -71,4 +71,32 @@ $this->skin = $skin; $this->template = &$template; } + + + /** +* +* @param string $fieldName +* @param array $item +*/ + protected function mergeSkinDataArray( $fieldName, $item ) { + if( !isset( $this->template->data[$fieldName] ) ) { + $this->template->data[$fieldName] = []; + } + + $this->template->data[$fieldName] = array_merge( $this->template->data[$fieldName], $item ); + } + + /** +* +* @param string $fieldName +* @param array $item +*/ + protected function appendSkinDataArray( $fieldName, $item ) { + if( !isset( $this->template->data[$fieldName] ) ) { + $this->template->data[$fieldName] = []; + } + + $this->template->data[$fieldName][] = $item; + } + } \ No newline at end of file -- To view, visit https://gerrit.wikimedia.org/r/405862 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic4e235be04d65edfe99f544b44e6fef671a35e40 Gerrit-PatchSet: 3 Gerrit-Project: mediawiki/extensions/BlueSpiceFoundation Gerrit-Branch: master Gerrit-Owner: Dvogel halloweltGerrit-Reviewer: Ljonka Gerrit-Reviewer: Mglaser Gerrit-Reviewer: Pwirth Gerrit-Reviewer: Robert Vogel Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...BlueSpiceFoundation[master]: Hook/SkinTemplateOutputPageBeforeExec: 2 new functions to ap...
Dvogel hallowelt has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405862 ) Change subject: Hook/SkinTemplateOutputPageBeforeExec: 2 new functions to append/merge .. Hook/SkinTemplateOutputPageBeforeExec: 2 new functions to append/merge fields in $template->data array These fiels are used to provide data for BlueSpiceSkin. The functions prevent notice if field is not definded before setting an value. Change-Id: Ic4e235be04d65edfe99f544b44e6fef671a35e40 --- M src/Hook/SkinTemplateOutputPageBeforeExec.php 1 file changed, 28 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceFoundation refs/changes/62/405862/1 diff --git a/src/Hook/SkinTemplateOutputPageBeforeExec.php b/src/Hook/SkinTemplateOutputPageBeforeExec.php index 3cee34b..fb38635 100644 --- a/src/Hook/SkinTemplateOutputPageBeforeExec.php +++ b/src/Hook/SkinTemplateOutputPageBeforeExec.php @@ -71,4 +71,32 @@ $this->skin = $skin; $this->template = &$template; } + + + /** +* +* @param string $fieldName +* @param array $item +*/ + protected function mergeSkinDataArray( $fieldName, $item ) { + if( !isset( $this->template->data[$fieldName] ) ) { + $this->template->data[$fieldName] = []; + } + + $this->template->data[$fieldName] += $item; + } + + /** +* +* @param string $fieldName +* @param array $item +*/ + protected function appendSkinDataArray( $fieldName, $item ) { + if( !isset( $this->template->data[$fieldName] ) ) { + $this->template->data[$fieldName] = []; + } + + $this->template->data[$fieldName][]= $item; + } + } \ No newline at end of file -- To view, visit https://gerrit.wikimedia.org/r/405862 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic4e235be04d65edfe99f544b44e6fef671a35e40 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/BlueSpiceFoundation Gerrit-Branch: master Gerrit-Owner: Dvogel hallowelt___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits