a() public static method

Generates a hyperlink tag.
See also: yii\helpers\Url::to()
public static a ( string $text, array | string | null $url = null, array $options = [] ) : string
$text string link body. It will NOT be HTML-encoded. Therefore you can pass in HTML code such as an image tag. If this is coming from end users, you should consider [[encode()]] it to prevent XSS attacks.
$url array | string | null the URL for the hyperlink tag. This parameter will be processed by [[Url::to()]] and will be used for the "href" attribute of the tag. If this parameter is null, the "href" attribute will not be generated. If you want to use an absolute url you can call [[Url::to()]] yourself, before passing the URL to this method, like this: ```php Html::a('link text', Url::to($url, true)) ```
$options array the tag options in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using [[encode()]]. If a value is null, the corresponding attribute will not be rendered. See [[renderTagAttributes()]] for details on how attributes are being rendered.
return string the generated hyperlink
コード例 #1
0
ファイル: Html.php プロジェクト: miptliot/vps-tools
 /**
  * Overwritten method. By default i18n is used.
  * @inheritdoc
  */
 public static function a($text, $url = null, $options = [])
 {
     if (isset($options['raw']) and $options['raw'] == true) {
         unset($options['raw']);
         return parent::a($text, $url, $options);
     } else {
         unset($options['raw']);
         return parent::a(Yii::t('app', $text), $url, $options);
     }
 }
コード例 #2
0
ファイル: login.php プロジェクト: alejandrososa/AB
use yii\web\Response;
use yii\helpers\BaseHtml;
//use yii\widgets\ActiveForm;
use yii\bootstrap\ActiveForm;
use yii\authclient\widgets\AuthChoice;
/* @var $this yii\web\View */
/* @var $form yii\widgets\ActiveForm */
/* @var $modelAcceder \app\modules\micuenta\models\AccesoForm() */
/* @var $modelRegistrarse \app\modules\micuenta\models\CrearCuentaForm() */
/* @var $tabs array */
$inputOpciones = ['template' => "<div class=\"col-xs-12\">\n{input}\n{error}\n{hint}\n</div>", 'options' => ['class' => 'form-group m-b-3']];
$url_terminos = Yii::$app->urlManagerMicuenta->createUrl(['/terminos-de-uso']);
$url_politica = Yii::$app->urlManagerMicuenta->createUrl(['/politica-privacidad']);
$texto_condiciones = BaseHtml::a('términos de uso', $url_terminos);
$texto_condiciones .= Yii::t('app', ' y la ');
$texto_condiciones .= BaseHtml::a('política de privacidad.', $url_politica);
$checkOpciones = ['template' => "<div class=\"col-xs-12\"><div class=\"checkbox checkbox-custom\">\n{input}\n{beginLabel}\n{labelTitle} {$texto_condiciones} \n{endLabel}\n{error}\n{hint}\n</div></div>", 'options' => ['class' => 'form-group']];
?>



<div class="cd-user-modal"> <!-- this is the entire modal form, including the background -->
    <div class="cd-user-modal-container"> <!-- this is the container wrapper -->
        <ul class="cd-switcher">
            <li><a href="#0"><?php 
echo $tabs['acceder'];
?>
</a></li>
            <li><a href="#0"><?php 
echo $tabs['registrarse'];
?>
コード例 #3
0
ファイル: Html.php プロジェクト: singletonn/yii2-helpers
 public static function a($text, $url = null, $options = [])
 {
     $options['class'] .= ' ink-reaction';
     return parent::a($text, $url, $options);
 }
コード例 #4
0
ファイル: CrearCuentaForm.php プロジェクト: alejandrososa/AB
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return [['nombre', 'filter', 'filter' => 'trim'], ['nombre', 'required'], ['nombre', 'string', 'min' => 2, 'max' => 255], [['nombre'], 'match', 'pattern' => "/^.{5,50}\$/", 'message' => 'Mínimo 5 y máximo 50 caracteres'], ['correo', 'filter', 'filter' => 'trim'], ['correo', 'required'], ['correo', 'email'], ['correo', 'string', 'max' => 255], ['correo', 'unique', 'targetClass' => '\\common\\models\\Usuarios', 'message' => 'Este correo no está disponible.'], ['clave', 'required'], ['clave', 'string', 'min' => 6], [['clave'], 'match', 'pattern' => "/^.{5,15}\$/", 'message' => 'Mínimo 5 y máximo 15 caracteres'], ['term_cond', 'required', 'requiredValue' => 1, 'message' => 'Debes aceptar las condiciones de uso ' . BaseHtml::a('Signup.', ['site/signup'])]];
 }