Plugin for an extended structure field with more than one kind of field set


#21

Just as an update, I now have this plugin running on two different blueprints/templates (in both cases building table rows with a couple variables and options) on a live site, and it is working terrific. This is really gonna help me recommending Kirby in some cases at work where I needed this kind of extended structure, so thanks again.


#22

Wow, talk about lucky, this came just days before I needed it! Going to try it right away, awesome work timoetting!!!


#23

Great plugin! :smiley:

Just a quick question: how can I use the checkboxes field? Every time I try to call a checkbox var in my template, nothing is displayed, yet it is stored in the main var as part of a list. Is the field being affected by the tostructure() function or is it an incompatible field as stated in the known issues disclaimer?


#24

Hey @invasoria ,

The original structure field has some issues handling lists, eg coming from checkboxes. The Builder Plugin somehow inherited those problems. The content data for checkboxes is then stored as

checkboxfield[]:
    - optionOne
    - optionTwo
    - optionFour

and not like

checkboxfield: optionOne, optionTwo, optionFour

as it would be the case with a normal checkbox field that is not inside a structure or builder field. The problem is, that you cannot call the variable checkboxfield[] properly inside a template, because it would end up in something like ...->checkboxfield[](). I dont’ know if @bastianallgeier is aware of this problem. Maybe he has a solution for this? I will have a closer look on this as soon as I will find the time.


#25

A workaround to fetch the value is this:

foreach($....->get('checkboxfield[]') as $...) { 
       //do stuff
      }

#26

Thanks @timoetting,

I was suspecting that, but no problem, the Builder plugin still works great and is VERY useful.

@texnixe, I actually got around it with a dirty trick. Since the whole var displays as plain html after an ‘echo’ I just used a string replace like this:

<div class="item <?php echo str_replace("<br />", " ", $section); ?>">

But I don’t like it, it feels unnecessary. Also, I end up with a whole bunch of non existent classes because the whole var gets printed. I’m going to try your suggestion, to see what I get.

Edit:

Yes, that worked great @texnixe, thank you! :smiley:


#27

Just stumbled upon this thread and I really appreciate your plugin! I’ve been using the Advanced Custom Fields plugin for WordPress for about 4 years now and a flexible content field was the one feature, that was really missing in kirby. When looking at some commercial WordPress themes that feature a page builder or sites like Medium, I think this is the way to go for high-quality content. I like to call this a »block-based« content approach.

Some of my client websites have pages with an variable number of different sections in one content area which include complex modules like galleries, tabular data or video players. For the latter one, a kirbytag might do the job pretty well, but I think that the block-approach is more user-friendly because it allows me as a designer to provide UI for any kind of content. This becomes especially important when metadata and behavior of components come into play. Image an hCard-kirbytag for example. What a nightmare! I think, there is no user-friendly way to deal with such a complex component by using just one big text input and special markup. Providing a UI for those cases also has the big advantage, that a user will not have a problem editing content after a long time of absence from the panel. I also prefer it over WordPress’ approach of inserting live previews of galleries etc. into the editor, because using »blocks« gives us a logical data structure and a separation between content and output code that is easier to deal with in templates. One the other hand, markup like Markdown, combined with kirbytags (or something similar) is great and very effective for less complex components like buttons, pull-quotes or lists.

Cant’t wait to integrate your plugin into the next revision of my portfolio and future client projects (at least those, where the client does not insist on using WordPress :wink: )!


#28

This is brilliant. Thanks @timoetting!


#29

I have noticed one small issue. On a multilingual site with debug set to true, I get the following notice:

Notice: Trying to get property of non-object in .../kirby/branches/multilang/page.php on line 199
Notice: Trying to get property of non-object in .../kirby/branches/multilang/page.php on line 202

Everything is working though. Can anybody confirm this behaviour?

Thanks


#30

Yep … same here, but since everything is working I was to lazy to post a bug report O:-)


#31

Hey @timoetting

I just threw a pull request at you for a (very small) feature I wanted to have in my own implementation of this.


#32

love ACF; if this is anything like it it’ll be great! excited to give it a try!


#33

Tim,

thanks for your efforts in developing this plugin. i feel this block building approach is the way to go when handing a cms over to the client.

i installed the plugin and see the ‘builder’ field in the panel, but as soon as i attempt to add a block i get the following error message.

“Fatal error: Uncaught exception ‘Exception’ with message ‘Invalid route’ in C:\wamp\www\kirby.dev\panel\app\panel.php on line 203”

could this be some wamp setting that’s causing this error in my local enviornment? any insight would be greatly appreciated.


#34

For the hell of it i completely ditched my install, reinstalled kirby 2.1.1 and reinstalled this plugin. It’s working fine now, but that doesn’t make me feel confident using this plugin on a production site. This is a very important feature that i wish was in Kirby’s core. It would be helpful to understand what the issue was. Any insight would still be very welcome.


#35

Hey,

for now, I have no idea what caused your error :slight_smile: Can you give me some insights on how your previous installation differed from your new installation? Did you have some other plugins running etc. ?


#36

thanks for the quick reply. i have the basic kirby starter kit installed. the previous and recent installs were exactly the same (e.g. same version). i did however have two additional plugins running on the previous install. they were the wysiwyg editor and the event calendar plugin.

i’m really liking this plugin though. nice work. it would be helpful if we could collapse the blocks.

so are you actively polishing this plugin? i wonder if Bastian’s interested at all in incorporating this feature into kirby’s core.


#37

Hi,

Just discovered this plugin and already love it !! :smile:
I have just one small remark : when being in multilanguage configuration, there are strange warnings displayed when adding or modifying a section:
Notice: Trying to get property of non-object in D:\progs\xampp\htdocs\kirby-2.1.2\kirby\branches\multilang\page.php on line 199
Notice: Trying to get property of non-object in D:\progs\xampp\htdocs\kirby-2.1.2\kirby\branches\multilang\page.php on line 202

I am using Kirby 2.1.2, and in the configuration file, I have the following:

c::set('languages', array(
   array(
      'code'    => 'en',
      'name'    => 'English',
      'locale'  => 'en_US',
      'default' => true,
      'url'     => '/'
   ),
   array(
      'code'    => 'fr',
      'name'    => 'French',
      'locale'  => 'fr_FR',
      'default' => true,
      'url'     => '/fr'
   )
));

#38

Hi @timoetting, can you make a guess when your plugin will work with v.2.2?


#39

Judging by looking at the current dev branch, it seems like there are some major changes to the plugin coming up. I’m especially excited about the omission of the plugins folder which enables it to be included as a submodule.

Hopefully this won’t be too long, fingers crossed!


#40

In your config.php only ONE language can have this row:

You can look at http://getkirby.com/docs/languages/setup

Good luck!