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

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.

1 Like

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

1 Like

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?

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.

A workaround to fetch the value is this:

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

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:

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: )!

2 Likes

This is brilliant. Thanks @timoetting!

1 Like

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

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

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.

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

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.

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.

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. ?

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.

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'
   )
));

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

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!

1 Like

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

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

Good luck!