-
-
Notifications
You must be signed in to change notification settings - Fork 480
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
Re-structuring #1445
Merged
Merged
Re-structuring #1445
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Basically reverts ae2022b
- Collection show view now shows a page tree if the collection has a structure. - You can switch between the tree and regular listing. It'll remember it in local storage. - Structure::make() accepts a handle. - $structure->handle() can be passed null and it'll still be chainable - The page tree component just does the page tree stuff, emits events, and just leaves the buttons etc to be handled in a parent component. - Page tree loads intial pages with ajax instead of passing the initial values. Unnecessary maintenance burden, not a huge deal.
…pdate. Adjust to the new config UX.
…erwise it just opens the link pane immediately.
- A structure-managed collection now has the structure defined in the collection's yaml file - Structure::find() and findByHandle() expect "collection::{handle}" as the handles when looking for a collection structure - Structure::all() merges in collection structures. - Page::setRoute() should allow a null route. The test wasn't catching this because the Structure::collection() logic was causing a collection to always be returned. (first where structurehandle is null always returned a match) - Store the collection handle alongside structure page uris. The urls only exist for collection-structures. Not nav-structures.
…into Facades\CP\Nav in preparation for more upcoming nav changes
- The root lives in the tree array. This is so that if you change whether its expecting a root, you don't have to also move the root. - The root/parent is pulled out of the array if its expecting a root - The primary reason it was a separate variable before was so you couldn't give it child pages. Just add an exception now.
- Navs are now the things stored in the stache and in yaml files - You can query Navs specifically, instead of getting all structures and filtering them manually. - Structure facade and repo is still a thing, but it just combines navs and collection structures. - Structured entry URIs are just stored on the entry instead of its own index. They get updated when the collection is updated. - expects_root is now just a root boolean
A few bugaroos 🐛
|
This is technically updating the prop which is not great, but works fine. shh.
This was referenced Mar 17, 2020
Hi @jasonvarga already getting errors after this was merged :) is there a way to migrate to this re-structure automatically like you mentioned? |
jasonvarga
referenced
this pull request
Apr 13, 2021
…i, so child page's uris continue on from the parent.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains a bunch of improvements to Structure-related areas.
Overview
Structures have been split into Navigation and Collection Structures.
Structures themselves still technically exist, but are more of an abstract code level thing.
Navigation
Navigation (or Navs) are now the things you were creating up until now.
A navigation is a type of structure that lives in your
content/navigation
directory. It's just a bunch of links and/or references to entries. Previously, you'd have a structure and you'd choose "navigation" as it's purpose. It replaces "Structures" in the CP sidebar.Collection Structures
Associating a structure with a collection was one of the biggest areas of confusion.
Now, instead of needing to create a structure and link that structure from the collection, you can simply opt to have a collection "be organized into a structure".
The structure will be stored in the collection's YAML file:
In the control panel, you will be able to easily toggle between the tree view and the table view.
Collection Ordering
Now that's simpler to define the structure of your entries, we've merged the concept of "ordering" into the structure.
Being orderable and being structured is basically the same thing. You're just dragging and dropping entries into the order you want. The only difference is that a structure lets you nest them.
So now instead of an explicit
orderable: true
item in your collection, you just enable the structure, and setmax_depth: 0
.This removes the need for the current
entry_order
array in the collection's yaml file. If at some point you want to change from a linear order to a nested one, you can just increase the max depth.In terms of UX, when you have a structure with a max depth of 1, you will get the existing table list view with drag handles.
Structure Root
The
expects_root
androot: some-id
on a structure was also confusing.The
expects_root
setting was there to control the UI, especially in the case where your structure didn't have any pages in it yet.We had a separate
root
to prevent you from adding child pages to it.Now, the "root" page is just simply part of the tree, and
root
is a boolean that defines whether the first item should be considered the root.This prevents you from needing to move the
root
in and out of the tree when you change theexpects_root
setting.Redirects
You were already able to add
redirect: somewhere
to an entry to have a redirect be triggered when you visit its url. Now, the actual URL will be its target. ie. when you do{{ url }}
in the front-end, you'll get the redirected URL.This also means that if you use the entry query builder (or a feature that uses it under the hood), then there may be more than one entry with the same url. Not necessarily a problem, just something to be aware of.
Collection Structure Links
Piggybacking off redirects, this is how you'd create redirects and links within a collection's structure. A redirect would simply be another actual entry. It would just have a
redirect
variable in it.When you click the "create entry" button in a collection, you'll get a "Link" option, as if it were one of your blueprints. This will give you the create entry screen with a title and redirect field.
If you create an
entry_link
blueprint, you can override these fields.Collection Tag and Links
By default, link entries (any entries with a
redirect
value) will be excluded from thecollection
tag. You can include them by adding thelinks="true"
(orredirects="true"
) parameter.Permissions
Permissions are now attached to navs, instead of structures.
The existing
reorder {collection} entries
permission will be used to control whether the tree can be edited.Control Panel "Nav"
We've changed
Statamic\Facades\Nav
to now deal with these new navs.The existing
Nav
class which let you add items to the CP's sidebar has been moved toStatamic\Facades\CP\Nav
.Breaking changes
These are obviously breaking changes, so we will provide a way for you to get updated without you having to do it all manually.
Closes #1094