Skip to content

Commit

Permalink
Change property visibility to allow more flexibility for apps (yiisof…
Browse files Browse the repository at this point in the history
…t#19696)

* Change property visibility to allow more flexibility for apps

* Update framework/web/View.php

Co-authored-by: Alexander Makarov <sam@rmcreative.ru>

* Added changelog

Co-authored-by: Alexander Makarov <sam@rmcreative.ru>
  • Loading branch information
lubosdz and samdark committed Nov 29, 2022
1 parent 1f0f701 commit fe46b59
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions framework/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Yii Framework 2 Change Log

- Enh #9740: Usage of DI instead of new keyword in Schemas (manchenkoff)
- Enh #19689: Remove empty elements from the `class` array in `yii\helpers\BaseHtml::renderTagAttributes()` to prevent unwanted spaces (MoritzLost)
- Chg #19696: Change visibility of `yii\web\View::isPageEnded` to `protected` (lubosdz, samdark)


2.0.47 November 18, 2022
------------------------
Expand Down
10 changes: 6 additions & 4 deletions framework/web/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,13 @@ class View extends \yii\base\View
public $jsFiles = [];

private $_assetManager;

/**
* Whether [[endPage()]] has been called and all files have been registered
* @var bool
* @since 2.0.44
*/
private $_isPageEnded = false;
protected $isPageEnded = false;


/**
Expand Down Expand Up @@ -179,7 +181,7 @@ public function endPage($ajaxMode = false)
{
$this->trigger(self::EVENT_END_PAGE);

$this->_isPageEnded = true;
$this->isPageEnded = true;

$content = ob_get_clean();

Expand Down Expand Up @@ -497,8 +499,8 @@ private function registerFile($type, $url, $options = [], $key = null)
}
$appendTimestamp = ArrayHelper::remove($options, 'appendTimestamp', $assetManagerAppendTimestamp);

if ($this->_isPageEnded) {
Yii::warning('You\'re trying to register a file after View::endPage() has been called');
if ($this->isPageEnded) {
Yii::warning('You\'re trying to register a file after View::endPage() has been called.');
}

if (empty($depends)) {
Expand Down

0 comments on commit fe46b59

Please sign in to comment.