diff --git a/docs/guide/helper-overview.md b/docs/guide/helper-overview.md index e47a9fc03f..3764a156c3 100644 --- a/docs/guide/helper-overview.md +++ b/docs/guide/helper-overview.md @@ -15,12 +15,13 @@ use yii\helpers\Html; echo Html::encode('Test > test'); ``` -> Note: To support [extending helper classes](#extending-helper-classes), Yii breaks each core helper class +> Note: To support [customizing helper classes](#customizing-helper-classes), Yii breaks each core helper class into two classes: a base class (e.g. `BaseArrayHelper`) and a concrete class (e.g. `ArrayHelper`). When you use a helper, you should only use the concrete version and never use the base class. -## Core Helper Classes +Core Helper Classes +------------------- The following core helper classes are provided in the Yii releases: @@ -39,19 +40,21 @@ The following core helper classes are provided in the Yii releases: - VarDumper -## Extending Helper Classes +Customizing Helper Classes +-------------------------- -To custom a core helper class (e.g. `yii\helpers\ArrayHelper`), you should extend from its corresponding base class -(e.g. `yii\helpers\BaseArrayHelper`) and name your class the same as the corresponding concrete class -(e.g. `yii\helpers\ArrayHelper`), including its namespace. +To customize a core helper class (e.g. [[yii\helpers\ArrayHelper]]), you should create a new class extending +from the helpers corresponding base class (e.g. [[yii\helpers\BaseArrayHelper]]) and name your class the same +as the corresponding concrete class (e.g. [[yii\helpers\ArrayHelper]]), including its namespace. This class +will then be set up to replace the original implementation of the framework. The following example shows how to customize the [[yii\helpers\ArrayHelper::merge()|merge()]] method of the [[yii\helpers\ArrayHelper]] class: ```php -namespace yii\helpers; +