juek / CustomSections

Developer plugin for rapid prototyping of custom section types in Typesetter CMS
GNU General Public License v2.0
3 stars 7 forks source link

New control type (bunch) #19

Closed a2exfr closed 4 years ago

a2exfr commented 7 years ago

To avoid parallel work with new control type. This gonna be extra control. Let call it somehow like multiply of controls( or bunch_control). The idea that this control (main) will have array of controls(sub). Will be acting somehow like multiply image, but instead of image on working table will be icons that lead to a-box with defined sub-controls. Think is nice enhancement. ?

I take this for future. Can't say when it be ready, have a little time(

juek commented 7 years ago

Good idea. This could be used to build dynamic stacks of discrete elements, such as forms. I once started a plugin called 'form builder' to act in a similar manner, but didn't make much headway. With our current approach, this is tangible. Yeah - go-go-go! ;)

a2exfr commented 7 years ago

Bunch control is on the way! I have doubt that it should be extra control. Because it need some changes to existing editor functions(a little). And it not specific (not for one project made) and can be used in many cases. Plus about 200 lines to editor, сan we afford it?

juek commented 7 years ago

Cool!

сan we afford it?

sure.

juek commented 7 years ago

I'd say, universal editor may even grow beyond 100K if needed and if it makes sense. CKE has 500K. Everything general-purpose is OK in here. I personally don't like files with much more than 1000 lines mostly for readability, but I think with the initial 'declaration block', we have a quite readable and properly searchable structure.

a2exfr commented 7 years ago

Here it is . Bucnh control and two section types. Multy shop image is only for demo and can be removed later, and bootstrap tabs section is one for the bunch control build for. With it easily can build such thing as carousel with captions and so on. Currently bunch control work with all default controls except link field and multi image( which have array of values) may be later add support for that fields. Actually autocomplete pages work but array values for sub control currently unsupported.

a2exfr commented 7 years ago

Of cause some separate made section for one purpose will be more usable then build with bunch control. But it faster to use it. Of cause it has some pluses and minuses. The main minus it a bit tricky to define.(array of arrays in values, and sub_controls array of arrays in bunch control in editor.) And some list todo with it. - made styles for sub controls(every sub control has class subcontrol), - may be better name view in editor, support for arrays in vals of sub controls? and so on.

juek commented 7 years ago

Awesome! I have yet to look into in in detail. Support of all default controls would be great but we also should keep all definitions as simple as possible - might be squaring the circle, though ;-).

a2exfr commented 7 years ago

In time of made it, I want to keep controls definition in editor untouched and use it as is- as sub controls. Only ckeditor was need to goes own way, cause it use admin box, as the bunch control. Therefore it rendered at once bunch control box started.

thomasfrobieter commented 7 years ago

Hey, short question:

is the attributes array currently working on bunch_control sub items?

Example (only sub item):

        'machine_name' => array(
          'label' => 'Machine Name',
          'control_type' => 'text',
          'attributes' => array(
            'class' => 'machine-name',
            'placeholder' => 'Machine Name',
            'pattern' => '^[a-z0-9_]*$', // regex: start of string, lowercase letters, digits and underline
          ),
          'on' => array(
            'focus' => 'function(){ $(this).select(); }',
          ),
        ),

In my case none of the attributes are printed out.

a2exfr commented 7 years ago

is the attributes array currently working on bunch_control sub items?

Seems that no working, but should be. I 'm afraid, I 'm was not testing attributes of sub_controls. I will look to solve this.