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

ensure getEnvOption('pageObject'') resolves the PageObject #408

Merged
merged 3 commits into from
Feb 7, 2024
Merged

Conversation

nadar
Copy link
Contributor

@nadar nadar commented Feb 7, 2024

@nadar nadar requested a review from hbugdoll February 7, 2024 08:47
@nadar
Copy link
Contributor Author

nadar commented Feb 7, 2024

@hbugdoll now it resolves the NavItemPage object, which is the expected as the context key is known as pageObject and not navItemObject. Feel free to review. I have also ajdust the docs for the upcoming changes => https://luya.io/guide/cms/blocks.html#env-context-information

@nadar nadar self-assigned this Feb 7, 2024
@nadar nadar added the bug label Feb 7, 2024
@nadar
Copy link
Contributor Author

nadar commented Feb 7, 2024

@hbugdoll i'am going to merge, need to tag a fresh release. if there is anything left, please create a PR. thank you very much for all the hints and help.

@nadar nadar merged commit 2e8df4b into master Feb 7, 2024
15 checks passed
@nadar nadar deleted the nav-item branch February 7, 2024 13:22
@hbugdoll
Copy link
Member

hbugdoll commented Feb 7, 2024

@hbugdoll i'am going to merge, need to tag a fresh release. if there is anything left, please create a PR. thank you very much for all the hints and help.

I'm a little bit to late, my review is just finished. It's all ok.
Thank you for your patience.

@hbugdoll
Copy link
Member

hbugdoll commented Feb 7, 2024

I have also ajdust the docs for the upcoming changes => https://luya.io/guide/cms/blocks.html#env-context-information

pageObject: Returns the luya\cms\models\NavItemPage object where you can run luya\cms\models\NavItemPage -> getNavItem() to retrieve the luya\cms\models\NavItem object, from there its possible to run luya\cms\models\NavItem -> getNav() to retrieve the luya\cms\models\Nav

We only have to adjust the docs again...
As I have learned now, getNavItem() and getNav() returns not the NavItem resp. Nav objects.

@nadar
Copy link
Contributor Author

nadar commented Feb 7, 2024

thats the relation loading concept uf yii2, i assume people are familiar with those concepts. We have to point to the relations getXYZ() method, as they exists in the docs: https://api.luya.io/luya-cms-models-navitempage.html#getNavItem()-detail

Or did i understand you wrong?

@nadar
Copy link
Contributor Author

nadar commented Feb 7, 2024

@hbugdoll but please feel free to extend and improve the docs, its always welcome 👍

@hbugdoll
Copy link
Member

hbugdoll commented Feb 7, 2024

In my opinion it is misleading because you have to call $this->getEnvOption('pageObject')->navItem->nav
instead of $this->getEnvOption('pageObject')->getNavItem()->getNav().

@nadar
Copy link
Contributor Author

nadar commented Feb 7, 2024

Sure, you can extend this. For me it was important to point into the api docs and i assume people understand the relation concept uf yii2. but please add some more extra text if you like 👍

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

Successfully merging this pull request may close these issues.

2 participants