Вот код yii2:
<?php $form = ActiveForm::begin([ 'options' => [ 'id' => 'category_id', 'class' => 'mws-form wzd-validate']]); ?> <?= $form->field($model, 'name') ?> <?php ActiveForm::end(); ?>
И вывод HTML:
<form id="cat_form" class="mws-form wzd-validate" action="/text/backend/web/index.php?r=cat%2Fcreate" method="post"> <input type="hidden" name="_csrf" value="ZHAzcENzcUI.PEofNCkdNVU7bDslOj4XIUAEFHsDNjUsRVgocUQVCw=="> <div class="mws-form-row"> <div class="form-group field-cat-name required"> <label class="control-label" for="cat-name">Name</label> <input type="text" id="cat-name" class="form-control" name="Cat[name]"> <p class="help-block help-block-error"></p> </div> </div> </form>
Я хочу преобразовать HTML выше:
<form id="cat_form" class="mws-form wzd-validate" action="/text/backend/web/index.php?r=cat%2Fcreate" method="post"> <input type="hidden" name="_csrf" value="ZHAzcENzcUI.PEofNCkdNVU7bDslOj4XIUAEFHsDNjUsRVgocUQVCw=="> <div id class="mws-form-row"> <label class="mws-form-label">Name <span class="required">*</span></label> <div class="mws-form-item large"> <input type="text" name="name" class="required" /> </div> </div> </form>