diff --git a/CHANGELOG.md b/CHANGELOG.md index 3be809d..6317b01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Yii1 Symfony Mailer extension - Enh: Added passing email message instance via `$_message` context variable to the template (klimov-paul) - Enh: Added passing template context variables to the layout template (klimov-paul) +- Enh: Added `View::createAbsoluteUrl()` method as a shortcut to `CApplication::createAbsoluteUrl()` (klimov-paul) 1.0.0, May 10, 2024 diff --git a/README.md b/README.md index 9ea4586..75e9b89 100644 --- a/README.md +++ b/README.md @@ -170,6 +170,8 @@ $this->layout = 'particular-layout'; ?>

Greetings

Context var "name" =

+ +Unsubscribe ``` diff --git a/src/View.php b/src/View.php index b6d6fbc..19fdb36 100644 --- a/src/View.php +++ b/src/View.php @@ -271,4 +271,20 @@ public function endClip(): void { $this->endWidget(ClipWidget::class); } + + /** + * Creates an absolute URL based on the given controller and action information. + * + * @since 1.0.1 + * + * @param string $route the URL route. This should be in the format of 'ControllerID/ActionID'. + * @param array $params additional GET parameters (name=>value). Both the name and value will be URL-encoded. + * @param string $schema schema to use (e.g. http, https). If empty, the schema used for the current request will be used. + * @param string $ampersand the token separating name-value pairs in the URL. + * @return string the constructed URL + */ + public function createAbsoluteUrl(string $route, array $params = [], string $schema = '', string $ampersand = '&'): string + { + return Yii::app()->createAbsoluteUrl($route, $params, $schema, $ampersand); + } } \ No newline at end of file