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

Support for arrays in section values? #6

Closed a2exfr closed 7 years ago

a2exfr commented 7 years ago

May be we should add support for arrays in section values?

Now it's limited for value like

{{$value}}

Suggestion to add support, that $value can be array like

{{<div class="element">||$value||</div>}}

and if $value is_array wrap each element in <div class="element"></div>then foreach in string, and replace.

It's clear that for one level arrays only.

May be another syntax, or another solution?

For what is need - I'm thinking of multiply image field with own media plate.

Also I think we need one more eval here.

  $gp.response.updateContent = function(arg){
    gp_editor.edit_section.html(arg.CONTENT);
 //use some js on loaded content
  };

let call it- js_on_content

$editor = array( 'js_on_content' => false )

?

juek commented 7 years ago

Go for it! ;o)

juek commented 7 years ago

If we support array, we should probably also add checkbox-group and multi-select controls to universal editor (in addition to your upcoming multi-image control :o)

juek commented 7 years ago

BTW: Next thing I will implement is a link-field control (with autocomplete for internal urls and "open in new window" option, auto-enabled for external urls. Just need to adapt it from other plugins.

a2exfr commented 7 years ago

Go for it!

ok)) I just wanted to discuss)

If we support array, we should probably also add checkbox-group and multi-select controls to universal editor (in addition to your upcoming multi-image control :o)

On first look can't imagine for what it can be used in section. But multi image field can be used for some sliders (js stuff) or mini galleries. Will made it

juek commented 7 years ago

On first look can't imagine for what it can be used in section

E.g. for Tags, Social Media Icons, all sorts of lists containing predefined items, etc.

juek commented 7 years ago

The new link-field control will also benefit from array support (for url and target), see current commit