Open JorgeAnzola opened 5 years ago
just checking in, is this repo still active? this request would make the plugin so much more user friendly!
@lukasIO To be honest, we'd probably only address bugs at this stage - but i'll keep this here and if we have a spare bit of time, we can addsomething in to handle this.
appreciate the clarification, thanks! would you be open to PRs ?
Yeah, absolutely :)
For anyone trying to implement this, here is a quick and dirty workaround:
To this:
foreach ($entryTypes as $entryType) {
$children[$i][] = [
'key' => 'section:' . $entryType->uid,
'label' => $entryType->name,
'data' => [
'has-structure' => true,
'default-sort' => 'structure:asc',
'type' => 'structure',
'handle' => $entryType->handle,
'entry-type' => true,
// Add these lines -->
'section' => $entryType->section->handle,
'typeId' => $entryType->id
// <-- end
],
'criteria' => [
'sectionId' => $entryType->sectionId,
'type' => $entryType->handle,
'editable' => false,
]
];
}
Now the current section handle and entry type ID are in the data attributes of the links in the sidebar, we can use JS to change the 'New entry' button to create an entry in the currently selected section and entry type. Injecting custom JS into the control panel can be done with this plugin: https://github.com/doublesecretagency/craft-cpjs
The JS to use is here: https://gist.github.com/croxton/e7dae90a447c27ce929a13dcebe2c0ca
It would be great if this could incorporated into the plugin.
When you are in the overview of an entry type, for example in the company > portfolio (See image below), and you click the new entry button, a dropdown appears (Like in all entries) instead of going directly to the new entry edit page. Maybe adding ?typeId=x in the URL?