mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-15 05:45:33 +08:00
BaseListView - errors rendering added
This commit is contained in:
@@ -78,11 +78,12 @@ abstract class BaseListView extends Widget
|
|||||||
* The following tokens will be replaced with the corresponding section contents:
|
* The following tokens will be replaced with the corresponding section contents:
|
||||||
*
|
*
|
||||||
* - `{summary}`: the summary section. See [[renderSummary()]].
|
* - `{summary}`: the summary section. See [[renderSummary()]].
|
||||||
|
* - `{errors}`: the errors section. See [[renderErrors()]].
|
||||||
* - `{items}`: the list items. See [[renderItems()]].
|
* - `{items}`: the list items. See [[renderItems()]].
|
||||||
* - `{sorter}`: the sorter. See [[renderSorter()]].
|
* - `{sorter}`: the sorter. See [[renderSorter()]].
|
||||||
* - `{pager}`: the pager. See [[renderPager()]].
|
* - `{pager}`: the pager. See [[renderPager()]].
|
||||||
*/
|
*/
|
||||||
public $layout = "{summary}\n{items}\n{pager}";
|
public $layout = "{summary}\n{errors}\n{items}\n{pager}";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders the data models.
|
* Renders the data models.
|
||||||
@@ -90,6 +91,15 @@ abstract class BaseListView extends Widget
|
|||||||
*/
|
*/
|
||||||
abstract public function renderItems();
|
abstract public function renderItems();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders the list of errors, if there are any
|
||||||
|
* @return string the rendering result
|
||||||
|
*/
|
||||||
|
public function renderErrors()
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the view.
|
* Initializes the view.
|
||||||
*/
|
*/
|
||||||
@@ -131,6 +141,8 @@ abstract class BaseListView extends Widget
|
|||||||
public function renderSection($name)
|
public function renderSection($name)
|
||||||
{
|
{
|
||||||
switch ($name) {
|
switch ($name) {
|
||||||
|
case '{errors}':
|
||||||
|
return $this->renderErrors();
|
||||||
case '{summary}':
|
case '{summary}':
|
||||||
return $this->renderSummary();
|
return $this->renderSummary();
|
||||||
case '{items}':
|
case '{items}':
|
||||||
|
|||||||
Reference in New Issue
Block a user