How to make custom block available

Permalink 1 user found helpful
I'm really new to concrete5 and I have searched the forum for an answer to this, but just not getting it.

How do I get a custom block to show up as "Awaiting Installation" and/or to be available for selection from a page in edit mode?

I need to build a custom block so I cloned the HTML block and renamed the folder to symas_test. I put the folder in /myWeb/packages/symas_test/blocks/ and put a controller.php in the symas_test directory. I edited the controller.php based on some sample code I found, but nowhere does it suggest how to get my concrete5 web to "see" this new block.

What am I missing here?

<?php
defined('C5_EXECUTE') or die(_("Access Denied."));
class Symas_Test extends Package {
protected $pkgHandle = 'iframe';
protected $appVersionRequired = '5.2.0';
protected $pkgVersion = '1.0';
public function getPackageDescription() {
return t("Insert a Symas Test.");
}
public function getPackageName() {
return t("Iframe");
}
public function install() {
$pkg = parent::install();
// install block
BlockType::installBlockTypeFromPackage('symas_test', $pkg);
}
}

View Replies: View Best Answer
TheRealSean replied on at Permalink Reply
TheRealSean
It looks lie you have copied a package not a block a block controller would look something like this
class SymasTestController extends BlockController{
}

also your pkgHandle is using the iFrame handle this should be something Like
"Symas Test"

If you want something simple I reccomend using the Designer Content Block this takes the hassle out of all this for you

http://www.concrete5.org/marketplace/addons/designer-content/...

<?php
defined('C5_EXECUTE') or die(_("Access Denied."));
class SymasTest extends Package {
protected $pkgHandle = 'symas_test';
protected $appVersionRequired = '5.5.1';
protected $pkgVersion = '1.0';
public function getPackageDescription() {
return t("Insert a Symas Test.");
}
public function getPackageName() {
return t("Symas Test");
}
public function install() {
$pkg = parent::install();
// install block

If you only want to install a block you do not need to use a package, to do so you would only need to place the block folder in the /root/blocks/ folder
and then you can install things from there.

But go and take a look at Jordans Block it really is a great time saver
dsw528 replied on at Permalink Reply
I actually really need help with this right now.
I am using the Designer Content Add-On. I created the block locally, then I uploaded the new block to the /blocks/ folder on my server, but it does not show up in the Add Block list.
Any help with this would be greatly appreciated.
mikefatty replied on at Permalink Best Answer Reply
mikefatty
HI

When u upload a costume block you have to upload it in your dir: root/blocks, and then go to your dashboard on the your site and under /Stacks & Blocks/Block Types and install it first! Now it will be available in the ADD block list.


/Mike
dsw528 replied on at Permalink Reply
Thank you very much. Worked like a charm.
I didn't see this step in the documentation, I probably just passed it up.
Thanks again!
mikefatty replied on at Permalink Reply
mikefatty
Your welcome, i glad you can get on now;) btw. can u "mark my answer as the best answer" just so others can easily see what to do, if they have the same problem as u, then they don't have to read the hole conversation is this thread :)

Take care
/Mike
dsw528 replied on at Permalink Reply
I would mark it as the best answer, but I'm actually not the one who started this thread. Sorry about that.
Thanks again though! :)