The plugin also comes with the handy placeholder variable _fileUrl that can be used inside your entry templates of the blueprint to get thumbnails in your structure panels.
fields:
...
builder:
label: Sections
type: builder
fieldsets:
bodytext:
label: Body Text
fields:
text:
label: text
type: textarea
linkedImage:
label: Linked Image
entry: >
<img src="{{_fileUrl}}{{image}}" height=120px/></br>
{{url}}
fields:
image:
label: Category
type: select
options: images
url:
label: Link Url
type: text
quote:
label: Quote
entry: >
<i>"{{text}}"</i></br></br>
{{citation}}
fields:
text:
label: Quote Text
type: textarea
citation:
label: Citation
type: text
This will give us a section field like this:
The content will be stored like this:
----
Builder:
-
text: >
Lorem ipsum dolor sit amet, consectetur
adipisicing elit. Ipsa, rerum quam
similique numquam doloremque, quidem
sequi placeat quibusdam aspernatur
doloribus tempore, obcaecati eligendi
odio eaque repellendus accusamus veniam
blanditiis impedit.
_fieldset: bodytext
-
image: forrest.jpg
url: www.getkirby.com
_fieldset: linkedImage
-
text: >
Power is of two kinds. One is obtained
by the fear of punishment and the other
by acts of love. Power based on love is
a thousand times more effective and
permanent then the one derived from fear
of punishment.
citation: Mahadma Gandhi
_fieldset: quote
@jenstornell yes, I worked with the advanced custom fields plugin for wordpress a while ago. I think this has also been the initial motivation iancox’s topic I mentioned in my original post.
However, the idea of a page builder is quite common amongst modern cms, especially those hosted solutions like wix or squarespace. So, I can’t really tell you where my “inspiration” came from. I just needed it for a project And this solution was the most obvious one
Great job @timoetting! This is a topic which was discussed a lot here in the forum. Can’t wait to try it out.
Nevertheless, I have one suggestion: It would be awesome to have the opportunity to hide a fieldset temporarily. So a third button „hide“ (beside „edit“ and „delete“) would be fantastic. For the moment it’s possible to add a checkbox „hide me“ to each fieldset and to check for this, but a native solution would be awesome
Is the install process more than just putting the /plugin and /builder files in there and then modifying the blueprint?
I just tried to get started by copying those two folders and then copied the builder: structure from your GitHub Repo into an existing blueprint, and I get this…
yes, the install process only requires you to put the content of the two folders from the github repo into site/fields/builder/and site/plugins/builder/ and to add your builder fields to the blueprints. I’m not exactly sure if you really refer to the right folders by writing “/plugin and /builder” .
Following these steps the Extension should be up and running. I just rechecked this process and could not reproduce your error. Did you try to get it running on a new Kirby installation?
On what exact page did this error occur? Is it every page in the panel or just the particular one that is affected by the plugin? Do you have to perform a specific action to get this error (e.g. adding a new field)? And do you have other plugins running on your site?
Thanks for the suggestion. However, I try to consider carefully whether the need for additional interface elements is more relevant than remaining with given patterns from the original structure field. I think your custom solution with a “hide me” checkbox is a really good way to accomplish the scenario of temporarily hiding sections. This is why I’m not sure if this would make so much sense to add natively.
It’s an existing Kirby installation. I’ve copied over ~/site/fields/builder and ~/site/plugins/builder into their appropriate directories. Then I took an existing template (in this case it’s called hopper.php) and copy/pasted the structure from the repo just to try to give myself a starting point to work with.
It starts out looking like it’s going to work, but then when I try to select something from the “Add” dropdown, I get the error screenshotted above.
Here is a gist of the hopper.php that’s giving me an issue right now.
I’m going to try to start a new blueprint just to see if the issue is that I’m starting with a blueprint that has previously existed.
PS: Cache is currently set to false while I try to get this figured out.
Update: Hmmm, no go. I added a new blueprint to the project using the same structure as this gist (but with a different title), and experienced the same results. I could access the page in the panel, but as soon as I picked a selection (any of the 3) from the “Add” menu, I get the PHP error alert box.
I just tested your blueprint from the gist and do not get any errors. To me this sounds like the folders are not in the correct location, and since the field does appear, I would guess, it’s a problem of the plugins folder.
@timoetting Thanks for your reply. I tested your plugin and it’s really awesome!
@AhoyLemon What’s your php-Version? I tried the plugin on an older machine with php 5.3.x and it doesn’t work. But e.g. with php 5.5.x everything runs fine …
Yeah, that’s totally the problem. Just checked, and it turns out the server is currently running v.5.3.10. So I’ll have to get that taken care of first.
Thanks for the direction, I’ll let you know how it goes after updating (which might not be for a couple days)
I installed the thing again (still running 5.3.10) and now the panel screen is looking like it should, without that PHP error. I’ll work on hooking in the snippets to pull in the data, but I’m optimistic.