Skip to content

[5.2] Blade push with layouts weird ordering #12769

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

Closed
wants to merge 3 commits into from

Conversation

mark86092
Copy link
Contributor

Original issue #12753

In this PR, fix the weird results in #12753.
After the fix, the results below is much more like what the "push" do

b0  c1  c2

Template:

>> a.blade.php
@stack('me')
>> b.blade.php
@extends('a')
@push('me') b0 @endpush('me')
>> c.blade.php
@extends('b')
@push('me') c1 @endpush('me')
@push('me') c2 @endpush('me')

This PR try to modify the $sections array, let the @push to save its state according to the renderNumber

There some drawbacks:

  1. People may manually modify their template, but this PR brokes their view
  2. They must clean their compiled view
  3. I have no idea how the test codes should be, at least I test on a runnig server

@@ -875,6 +898,35 @@ public function getSections()
}

/**
* Get the section from the last element.
Copy link
Member

Choose a reason for hiding this comment

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

missing newline

@crynobone
Copy link
Member

They must clean their compiled view

Shouldn't thing like this target 5.3/master branch.

@GrahamCampbell
Copy link
Member

Shouldn't thing like this target 5.3/master branch.

Hmmm. Is there a way to do this in a non-breaking way, so clearing will only be needed to fix the bug? We don't really want to break stuff on 5.3 unnecessarly either.

@mark86092
Copy link
Contributor Author

Actually, the internal structure of $sections is changed, all other behavior should be the same.

If the $sections structure keeps, I have to think another way, need trying.

@taylorotwell
Copy link
Member

Closing since breaking.

@mark86092
Copy link
Contributor Author

@taylorotwell what's your suggestion? goto 5.3 or try non-breaking way or do nothing?

@mark86092 mark86092 deleted the working-on-push branch March 28, 2016 16:12
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.

4 participants