schmunk42 / yii2-giiant

Yii 2 Framework Code Generator Gii on Steroids
271 stars 120 forks source link

Fix getting name attribute on cruds/view #284

Closed ioSeoGio closed 2 years ago

ioSeoGio commented 2 years ago

image If model has not default name attribute (not 'name', or 'title') (see yii2-gii yii\gii\generators\crud\Generator:221)- in breadcrumps will be used its ID attribute instead of getLabel() method (see yii2-giiant\src\generators\crud\default\views\view.php

By the way in a header of view's page use getLabel() method image

So I changed $generator->getNameAttribute() (gii module method) with $generator->genModelNameAttribute() (giiant crud RelationTrait method) After changing generation looks like image As you can see generator started using getLabel() method of model to get main name attribute

image

schmunk42 commented 2 years ago

Thank you!