Merge pull request #2941 from acs-ferreira/patch-34

Fix BaseStack widget
This commit is contained in:
Lucas Bartholemy 2018-01-15 17:46:09 +01:00 committed by GitHub
commit 50d866f231
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,13 +2,14 @@
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2017 HumHub GmbH & Co. KG
* @copyright Copyright (c) 2018 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
namespace humhub\widgets;
use Yii;
use yii\base\Widget;
/**
* StackWidget is a widget which can hold a set of subwidgets.
@ -36,14 +37,14 @@ class BaseStack extends \yii\base\Widget
*
* @var array
*/
public $widgets = array();
public $widgets = [];
/**
* Seperator HTML Code (glue)
*
* @var string
*/
public $seperator = "";
public $seperator = '';
/**
* Template for output
@ -51,14 +52,13 @@ class BaseStack extends \yii\base\Widget
*
* @var string
*/
public $template = "{content}";
public $template = '{content}';
/**
* Initializes the sidebar widget.
*/
public function init()
{
// Yii 2.0.11 introduced own init event
if (version_compare(Yii::getVersion(), '2.0.11', '<')) {
$this->trigger(self::EVENT_INIT);
@ -74,7 +74,7 @@ class BaseStack extends \yii\base\Widget
{
$this->trigger(self::EVENT_RUN);
$content = "";
$content = '';
$i = 0;
foreach ($this->getWidgets() as $widget) {
@ -123,7 +123,7 @@ class BaseStack extends \yii\base\Widget
if ($sortA == $sortB) {
return 0;
} else if ($sortA < $sortB) {
} elseif ($sortA < $sortB) {
return -1;
} else {
return 1;