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

[NodeBundle] Re-add the nodemenu again and make it lazy loading #581

Merged
merged 2 commits into from
Jul 23, 2015

Conversation

krispypen
Copy link
Contributor

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Fixed tickets /

Removing the nodemenu from the rendercontext brought lots of problems in:

  • everywhere you need it you first need to check if it's already created. You absolutely don't want to create it twice for one page rendering.
  • you had to create it in twig (!= template logic) and you sometimes need it already in the service method where you get it from the rendercontext. So also there you needed to create it
  • it's not always possible to create the nodemenu correct because you do not have all parameters (i.e. if it's a preview context or not)

My solution:

  • make it default available again, but made the contructor empty and use lazy loading

For the sluglistener-controllerserviceaction the nodemenu was never removed (see SlugSecurityListener L 76) , so these will also become faster since this lazy loading strategy.

@krispypen krispypen changed the title Re-add the nodemenu again and make it lazy loading [NodeBundle] Re-add the nodemenu again and make it lazy loading Jul 23, 2015
@@ -170,6 +184,7 @@ public function getTopNodes()
*/
public function getBreadCrumb()
{
$this->init();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t think you need to init() the whole menu to get breadcrumbs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, thanks!

no need to do init for the breadcrumb
…menuback

Conflicts:
	src/Kunstmaan/NodeBundle/Helper/NodeMenu.php
roderik pushed a commit that referenced this pull request Jul 23, 2015
[NodeBundle] Re-add the nodemenu again and make it lazy loading
@roderik roderik merged commit 516793f into Kunstmaan:master Jul 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants