TbHtml::activeUneditableField PHP Method

activeUneditableField() public static method

Generates an uneditable input for a model attribute.
public static activeUneditableField ( CModel $model, string $attribute, array $htmlOptions = [] ) : string
$model CModel the data model.
$attribute string the attribute.
$htmlOptions array additional HTML attributes.
return string the generated input.
    public static function activeUneditableField($model, $attribute, $htmlOptions = array())
    {
        parent::resolveNameID($model, $attribute, $htmlOptions);
        $value = parent::resolveValue($model, $attribute);
        TbArray::removeValues(array('name', 'id'), $htmlOptions);
        return self::uneditableField($value, $htmlOptions);
    }

Usage Example

Exemplo n.º 1
0
 public function testActiveUneditableField()
 {
     $I = $this->codeGuy;
     $html = TbHtml::activeUneditableField(new Dummy(), 'uneditable', array('class' => 'span'));
     $span = $I->createNode($html, 'span.uneditable-input');
     $I->seeNodeCssClass($span, 'span');
     $I->seeNodeText($span, 'Uneditable text');
 }
All Usage Examples Of TbHtml::activeUneditableField
TbHtml