Can templates be used to change edit.php behaviour (as opposed to just the view.php look)?
Permalink
I have been absolutely beating my head against a wall trying to get templates to change edit.php behaviour for a block I created (you ought to see the nice gibberish that I have made appear on the screen LOL utterly confusing C5 I think).
Specifically what I have been wanting to do is create different templates that use different rich text editors for a given block (which would use one editor...my favorite...as the default).
But after banging my head enough times...LOL...it finally dawned on me that templates might just be used to change the view.php of a block and that they can't be used to change anything in the way edit.php of the block runs.
Is that right?
Just trying to verify what seems to be the case before I develop a headache beating my head against the wall some more LOL.
I guess it might not hurt to ask...what is the best way to change the edit.php behaviour of a given block other than...well...create a new block?
Thanks.
Carlos
Specifically what I have been wanting to do is create different templates that use different rich text editors for a given block (which would use one editor...my favorite...as the default).
But after banging my head enough times...LOL...it finally dawned on me that templates might just be used to change the view.php of a block and that they can't be used to change anything in the way edit.php of the block runs.
Is that right?
Just trying to verify what seems to be the case before I develop a headache beating my head against the wall some more LOL.
I guess it might not hurt to ask...what is the best way to change the edit.php behaviour of a given block other than...well...create a new block?
Thanks.
Carlos
Assuming what you are looking for is a design pattern for your editor replacement -http://www.concrete5.org/community/forums/customizing_c5/need-input...
You could write edit.php for your block so that the edit interface is included or called from a package library folder. Have a base class in your library that all editors inherit from to preserve a consistent interface, and a simple dispatcher that selects which editor interface file in the library is currently the target for the dispatcher. The editor interfaces then provide whatever wysiwg javascript editors you want to build into it (or add later).
You could do the actual dispatching within the controller for the block, passing the selected editor interface to edit.php as a parameter.
Then you will need a means to configure which edit interface the dispatcher uses. This could be within the base class for the editor interfaces (so a user can swap editors with a control at the top of the edit popup) or within a single page (so it is configured more globally).
As for the dispatcher, there is a pattern to follow within C5, or you could invent something simple if all your edit interfaces are classes within a single library folder of your package.
You could write edit.php for your block so that the edit interface is included or called from a package library folder. Have a base class in your library that all editors inherit from to preserve a consistent interface, and a simple dispatcher that selects which editor interface file in the library is currently the target for the dispatcher. The editor interfaces then provide whatever wysiwg javascript editors you want to build into it (or add later).
You could do the actual dispatching within the controller for the block, passing the selected editor interface to edit.php as a parameter.
Then you will need a means to configure which edit interface the dispatcher uses. This could be within the base class for the editor interfaces (so a user can swap editors with a control at the top of the edit popup) or within a single page (so it is configured more globally).
As for the dispatcher, there is a pattern to follow within C5, or you could invent something simple if all your edit interfaces are classes within a single library folder of your package.
Outstanding input you guys!!
Thanks very much for the idea on how this might be done.
My goal has pretty much been a block that would allow one's to try different editors until they settle on one they like.
I also plan on including end user instructions that are dummy proofed for each editor such that a web developer could not only use the block but also use it on client sites where their clients could be given the super simply but thorough instructions on how to use the editing interface for the editor of their choice.
Lately I have been rather surprised, more like astounded, at how some clients are so incredibly computer illiterate.
The last client I took on was that way. Nice guy and all but I did not realize in taking on the project that I would end up having to be a computer tutor and bookeeper of what was still needed from this client to complete the project like I ended up having to be.
All in a day's work I guess but a simplified but effective content block would help I think.
Anyway I think for now I will just upload a block using one editor as a replacement for the standard Content block as a way to familiarize myself with the block contribution process here.
I'll play around with the rest as I have time to do so.
Carlos
Thanks very much for the idea on how this might be done.
My goal has pretty much been a block that would allow one's to try different editors until they settle on one they like.
I also plan on including end user instructions that are dummy proofed for each editor such that a web developer could not only use the block but also use it on client sites where their clients could be given the super simply but thorough instructions on how to use the editing interface for the editor of their choice.
Lately I have been rather surprised, more like astounded, at how some clients are so incredibly computer illiterate.
The last client I took on was that way. Nice guy and all but I did not realize in taking on the project that I would end up having to be a computer tutor and bookeeper of what was still needed from this client to complete the project like I ended up having to be.
All in a day's work I guess but a simplified but effective content block would help I think.
Anyway I think for now I will just upload a block using one editor as a replacement for the standard Content block as a way to familiarize myself with the block contribution process here.
I'll play around with the rest as I have time to do so.
Carlos
Otherwise, I think you'd just have to have one edit.php file that has some kind of control on it allowing users to change the interface (like a dropdown menu at the top), and then dynamically change the markup with javascript.