yii\i18n\Formatter::asEmail PHP Метод

asEmail() публичный Метод

Formats the value as a mailto link.
public asEmail ( string $value, array $options = [] ) : string
$value string the value to be formatted.
$options array the tag options in terms of name-value pairs. See [[Html::mailto()]].
Результат string the formatted result.
    public function asEmail($value, $options = [])
    {
        if ($value === null) {
            return $this->nullDisplay;
        }
        return Html::mailto(Html::encode($value), $value, $options);
    }

Usage Example

Пример #1
0
 public function testAsEmail()
 {
     $value = '*****@*****.**';
     $this->assertSame("<a href=\"mailto:{$value}\">{$value}</a>", $this->formatter->asEmail($value));
     // null display
     $this->assertSame($this->formatter->nullDisplay, $this->formatter->asEmail(null));
 }