Advanced Block Development: Part Two


At the start of this video, Andrew goes on to explain the error validation helper further. Check out the documentation page for the helper right here.

He also suffers through a bout of coughing! If you're fine just reading about the error helper, you can go ahead and skip ahead to 7:53, where Andrew starts discussing search.

Here is the function from the content block's controller that Andrew mentions:

    public function getSearchableContent(){
        return $this->content;

Essentially what happens here, is that when a concrete5 site runs the "index search engine" job, this function will be run and the content of the block will be put into the PageSearchIndex database table, which is what gets polled when someone uses a search block on your site.


Composer is a relatively new feature which allows certain pages to be created from within the dashboard rather than from the usual in-page editing experience. Editors can pick any kind of block to include when they are setting up the defaults for a composable page. However, blocks need a special view in order to correctly add and edit the block from within the composer interface.

The distinction between in-page editing and composer editing, from a content-saving perspective, is that when you add / edit a block in-page, you are only ever submitting changes to one block. In the case of composer, you are always submitting changes to multiple blocks. As such, the form fields in the composer view need to be named in such a way that they are distinguishable from eachother.

Here is the basic trick to make a block composerable:

  <textarea name="content">
  <textarea name="<?this->field('content')?>">

What the field function does is return the field name in such a way that it will be identifiable in the POST request which will save all of your blocks

Recent Discussions on this Topic

Custom Block View Tutorial

Attached is a white paper on creating custom block views. I am finding many C5 users do not understand this concept and even hesitate to modify purchased addons. I hope this is helpful. Please PM me if you have any additions or corrections and I …

Building a block with library image input?

I'm trying to build a block that has the ability to pull an image from the library (or, since I'm desperate, from anywhere, even a remote URL), but I can't figure it out, and I'm new to PHP... Does anyone have any pointers? I tried reading http://phple…

Adding smarter DISQUS to your concrete5

Guys, I've just finished figuring out a smarter way to implement Disqus, a third-party commenting system Sometime, you don't bother users to register on your site, but comment using Facebook, twitter or other social ID. Disqus is a fine comment s…

Check it out: custom block creator!

*** This package is now available on the marketplace: *** I've made a "custom block creator" which aims to solve the problem of allowing you (as the site designer) to specify exactly how som…

Issues with pasting a block from clipboard

When I paste my custom block from clipboard, it does copies the block but it does not seem functional. Do I need to use duplicate() function in my controller to get this to work properly? Can someone give me an example of using duplicate() function?