Skip to content

Instantly share code, notes, and snippets.

@umidjons
Created March 10, 2014 06:18

Revisions

  1. umidjons revised this gist Mar 10, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion yii-label-custom-text.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@

    `htmlOptions` of such `CHtml::activeLabel` and `CActiveForm::label` methods have `label` special option. It specifies the label to be displayed instead of `CModel::getAttributeLabel` value.

    ```html
    ```php
    <div class="form-group">
    <div class="col-sm-6">
    <?= $form->label( $model, 'source_title', [ 'label' => Yii::t( 'myApp', 'Resource title' ) ] ); ?>
  2. umidjons created this gist Mar 10, 2014.
    13 changes: 13 additions & 0 deletions yii-label-custom-text.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    #Set custom text for `label`

    `htmlOptions` of such `CHtml::activeLabel` and `CActiveForm::label` methods have `label` special option. It specifies the label to be displayed instead of `CModel::getAttributeLabel` value.

    ```html
    <div class="form-group">
    <div class="col-sm-6">
    <?= $form->label( $model, 'source_title', [ 'label' => Yii::t( 'myApp', 'Resource title' ) ] ); ?>
    <?= $form->textField( $model, 'source_title', [ 'class' => 'form-control', ] ); ?>
    <?= $form->error( $model, 'source_title', [ 'class' => 'text-danger' ] ); ?>
    </div>
    </div>
    ```