-
Notifications
You must be signed in to change notification settings - Fork 3
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
Wauw! Treasure trove, really... #1
Comments
First of all, thank you for your enthusiasm. Yes I fully agree this module needs splitting! Actually I'm in the process of upgrading a couple of projects to SS4 and this is why I created this module in the first place. I'm most certainly planning on splitting all this at some point, but I wanted to have a good grasp on the full scope before doing so and dividing things. Some things are not so easily splittable (I'm using helpers all over the place, I need subsite support so that's a tricky thing as well, ...). Also, currently, since I'm the only one using it, there is not much added value to split things just for the sake of it :-) |
I've been working on extracting a set of classes concerning (temporary) files & uploads (FilePond working well for back & front-end), and made some tweaks. Basically I've changed some of the 'Base...' classnames to be more descriptive (like AbstractFileUploadField instead of BaseFileUploadField). For some others, I've removed the 'Base' part and renamed them to be the same as the classes/traits they replace/extend, just in a different namespace. eg; namespace LeKoala\SilverStripe\Assets;
// Formerly \LeKoala\Base\Forms\BaseUpload
class Upload extends \SilverStripe\Assets\Upload
{ ... and: namespace LeKoala\SilverStripe\Forms;
use LeKoala\SilverStripe\Assets\Upload;
/**
* Trait FileUploadReceiver
* Adds better default descriptions and a better default uploadfolder to uploadfields
* formerly LeKoala\Base\Forms\BaseFileUploadReceiver
*
* trait UploadReceiver -> for a formfield which has an Upload() instance and can upload to a folder (no auto-saving into DO)
* class FileField (uses UploadReceiver implements FileHandleField) -> formfield which auto-saves into has-one on dataobject (->upload->loadIntoFile())
* trait FileUploadReceiver (uses UploadReceiver, calls constructUploadReceiver() from it) -> operations for writing uploaded files to DO's & into relations (also many_many etc)
*/
trait FileUploadReceiver
{
use \SilverStripe\Forms\FileUploadReceiver {
// alias constructUploadReceiver to overriddenConstructUploadReceiver
\SilverStripe\Forms\FileUploadReceiver::constructUploadReceiver as overriddenConstructUploadReceiver;
}
/**
* Override \SilverStripe\Assets\Upload with LeKoala\SilverStripe\Assets\Upload
*/
protected function constructUploadReceiver()
{
$this->overriddenConstructUploadReceiver();
// Change Upload instance to be a LeKoala\SilverStripe\Assets\Upload
$this->setUpload(Upload::create());
}
... I'd like to get your opinion on some of these changes if that's OK with you;
|
so sorry I didn't get the opportunity to write a proper answer to your proposal. But here it is!
|
I've been keeping a 'cms tweaks' module at hand myself but that's nothing compared to this gigantic collection of improvements. Going through the code in this module, I find a lot of usable stuff, thanks! For example we too often require just save & close, uploads in front-end, various form-related stuff, all great.
Just one remark; I'd like to use only certain parts in a framework-only project (right now mainly filepond, as per your recommendation). Currently this module requires a Page class & pulls in SiteConfig & some more. By default it creates various page types like block/news/contact/etc which is unwanted in this project. We also have our own basic news & FAQ modules, so that'd clash with this module currently. Plus I think 'save & close' is actually getting included into framework by default. Basically in its current state this module seems about 10 various 'Gridfield-enhancements' (all great) combined into one.
I'd like to kindly recommend to split up this module into 'domain-based' smaller modules, optionally with a composer recipe to pull them all in at once when needed (or just a regular composer package which requires all of them).
Domains could be like the headers in the README/namespaces:
We followed this route with our 'gridfield-pages' based modules in SS3, which consist of a reusable tagging (& categorizing) module, a Gridfield 'sitetree-button', exclude-children to hide pages from the sitetree & then some modules for specific purposes which pull them all in, like gridfieldpages, newsgrid, etc. For example the tagging & categorizing module can be re-used on its own which we do often. Also the excludechildren & sitetreebutton modules go installed a lot more than the actual newsgrid module, so apparently those provided some specific functionality usefull beyond the modules we developed them for.
Curious to hear what you think of this suggestion.
The text was updated successfully, but these errors were encountered: