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
[Feature][3.5][Ready] Custom headings and titles #1527
Conversation
[ci skip] [skip ci]
Ok so I removed the $fallback - I was right, much easier to read like this :-) Don't you just love it when you're right? :-)) Would love some feedback on using ACTION as the second parameter - what you guys think, if it's too cryptic or it's actually a good thing because it makes people look at the underlying code. If it's good because it makes it easier to understand WHERE it happens or bad because it prevents us from changing the method names in the future:
A sexier option would be to use the OPERATION name, but this feature will only be introduced in 3.5. Plus, what if an operation has multiple methods with views? You'd need to customize each one to a different thing and you couldn't do that by specifying the operation - you'll still need to specify the controller method. |
perfect to merge this with #1504 ;-) :-D |
@tswonke agreed! |
what about allowing an array for actions for some cases? e. g. |
As long as available actions are commented in the DocBlocks and are as close as possible to existing (e. g. access), I think they are ok. In the future (4.0...?) one can think about something more "change-stable"... |
@tabacitu Was going through all my PRs and to pull some files i had commited before but not merged yet, and noticed that we merged custom headings and title but there is no documentation that i can find on it for the website. was going to commit an edit for the docs but couldn't decide where to put it. TLDR; need documentation for this. |
@AbbyJanke I added the docs a while back, I don't know if it was before/after your post though... Here they are, under Operations - https://backpackforlaravel.com/docs/3.6/crud-operations#titles-headings-and-subheadings In hindsight, maybe we should put links to this in other places, maybe in each operation... |
Adds the ability to change what the title, heading and subheading of each CRUD page says.
The second parameter is the
controller method
where it will be used. Theaction
.Example:
There are a few differences from #1347
setShowTitle
), which on the one hand makes it easier to remember and allows the same functionality on future Operations, on the other hand is less sexy;My reservations regarding this PR are:
$fallback
is needed as parameter. We mostly use that in the views. But maybe plain old null-coalescing operator$crud->getTitle() ?? 'Some fallback'
would have been easier to read than$crud->getTitle('Some fallback')
;create
edit
show
index
listRevisions
reorder
Thoughts? @AbbyJanke ?