M
M
Maybe_V2016-06-14 18:40:20
Yii
Maybe_V, 2016-06-14 18:40:20

How to return html markup using a function?

For a single column in a GridView, the function returns the following:

[
                'attribute' => 'file',
                'format' => 'html',
                'label' => 'File',
                'value' => function($data){
                    if (!FileTypeManager::isPDFType('@fileManager/' . $data['file'])) {
                        return Html::img('@fileManager/' . $data['file'], ['width' => '150px']);
                    }else{
                        return Html::img('@serverFiles/' . 'server_pdf.png', ['width' => '150px']);
                    }


                }
            ],

I need a similar function, but only in a different column to return the following html code:
<div class="row">
        <div class="col-lg-6">
            <div class="input-group">
                <input disabled="false" type="text" class="form-control" placeholder="Search for...">
                <span class="input-group-btn">
        <button class="btn btn-default" type="button" >Copy</button>
      </span>
            </div>
        </div>
    </div>

Please help with a hint!
How can I do that ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2016-06-14
@webinar

Similar

'value' => function($data){
                   return '<div>Любой код</div>';
                    }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question