Skip to content
This repository has been archived by the owner on Jul 16, 2021. It is now read-only.

@push to view @stack from service provider #2439

Open
dillingham opened this issue Dec 11, 2020 · 2 comments
Open

@push to view @stack from service provider #2439

dillingham opened this issue Dec 11, 2020 · 2 comments

Comments

@dillingham
Copy link

dillingham commented Dec 11, 2020

A way to @push to a @stack from a service provider would enable packages the ability to extend other package's views.

$this->pushStack('jetstream::menu.after', 'package::notification-menu');

Adding hooks before and after specific parts of a UI would make it very extensible so other packages can inject views.

@stack('jetstream::header.before')
@stack('jetstream::header.after')
@stack('jetstream::dropdown.before')
@stack('jetstream::dropdown.after')
@stack('jetstream::profile.before')
@stack('jetstream::profile.after')

Maybe an optional array of views for "use first view":

$this->pushStack('jetstream::menu.after', ['notification-menu', 'package::notification-menu']);

You could even use this approach to populate vue components:

<script id="vue-component">
    @stack('package::vue-component.before')
    @include('package::vue-component')
    @stack('package::vue-component.after')
</script>
const VueComponent = {
  template: '#vue-component'
  // ...
}

Example Jetstream package scenarios:

Would allow Spark to be a "Premium Jetstream Package"

@dillingham dillingham changed the title Push to view @stack from service provider @push to view @stack from service provider Dec 16, 2020
@dillingham
Copy link
Author

dillingham commented Dec 21, 2020

@driesvints brought up a good point about unpredictable ordering in the socialite support PR.

A method to optionally control the order of stacks would be nice:

$this->pushStackOrder('jetstream::menu.after', [
    'package-one::notification-menu',
    'package-two::support-button',
]);

@dillingham
Copy link
Author

dillingham commented Dec 21, 2020

Maybe if a package includes views you don't want:

$this->pushStackIgnore('jetstream::menu.after', 'package-three::unwanted-view');

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

No branches or pull requests

1 participant