Hide/read-only a input that is not on a model scenario

Hey community,

What is the most clean way on yii2 to make hide/read-only my input if that property is not on my scenario ?

Example:




// my scenario model

return [

            'user-create' => ['username'],

            'admin-create' => ['username', 'email']

        ];







// My _form.php

    <div class="row">

        <div class="col-sm-6">

            <?= $form->field($user, 'username') ?>


        </div>

        <div class="col-sm-6">

            <?= $form->field($user, 'email') ?>

        </div>

    </div>




So in this case i wanna wide email for the user-create.

Important notes: I want to do this without create a specific _form for another scenario , and without make dirty code.