Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix getting name attribute on cruds/view #284

Merged
merged 1 commit into from
Dec 14, 2021
Merged

Fix getting name attribute on cruds/view #284

merged 1 commit into from
Dec 14, 2021

Conversation

ioSeoGio
Copy link
Contributor

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 schmunk42 requested a review from eluhr December 14, 2021 11:29
@schmunk42 schmunk42 merged commit 1dbc6ed into schmunk42:master Dec 14, 2021
@schmunk42
Copy link
Owner

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants