New custom Block type not being found

Permalink
I'm on 5.6.1.2 on WAMP stack

The system isn't detecting a block type I've built. "No custom block types are awaiting installation."

I've already built 5 custom block types this week without issue. It's probably something obvious, but I've gone over this with a fine tooth comb.

The files add.php, controller.php, db.xml, edit.php, form_setup_sc.php, icon.php, and view.php are all in /blocks/upbeat_soundcloud (along with the other blocks I've built).

This is the code from controller.php:

<?php defined('C5_EXECUTE') or die("Access Denied.");
class UpbeatScPlayerBlockController extends BlockController {
   protected $btTable = 'btUpbeatScPlayer';
   protected $btInterfaceWidth = "400";
   protected $btInterfaceHeight = "265";
   public function getBlockTypeName() {
      return t("Upbeat Soundcloud Player");
   }
   public function getBlockTypeDescription() {
      return t("Use this block to add a Soundcloud player.");
   }
}
?>


and this is the code from db.xml:

<?xml version="1.0"?>
<schema version="0.3">
   <table name="btUpbeatScPlayer">
      <field name="bID" type="I">
         <key />
         <unsigned />
      </field>
      <field name="title" type="C" size="100">
      </field>
      <field name="player" type="X2">
      </field>
   </table>
</schema>


Hopefully, this is just a "doh!" moment, but I just can't see what's wrong. Any ideas?

webdewd
 
webdewd replied on at Permalink Reply
webdewd
Nothing wrong with my code it seems. I've managed to recreate the issue. I rebuilt the block from scratch giving it a slightly different name. Same for class and db table. It now appears in blocks to install. If I change the name of the class and db table (both in controller and in db.xml), it disappears, change it back again and it reappears. Must be some deep rooted caching issue. I have Block Cache, Overrides Cache and Full page caching all switched to off.I also did a manual flush. Flushed the browser too.
jordanlev replied on at Permalink Best Answer Reply
jordanlev
The name of your controller class must be the CamelCase version of the folder_name. If your class name is UpbeatScPlayerBlockController, then the block folder name must be "upbeat_sc_player" -- not "UpbeatScPlayer", not "upbeat_s_c_player", etc.
webdewd replied on at Permalink Reply
webdewd
Jordanlev, You're right. Thanks. Paul
andrestoros replied on at Permalink Reply
Jordan. Thanks a loooottt!... I've been in this error issue all day long and it was your solution the one that works.

This should be written in BOLD RED in all block building tutorials.

Thanks again.
chawilaclef replied on at Permalink Reply 1 Attachment
chawilaclef
Sohttp://youtu.be/JcpxxRsii0U is wrong... ?
Cahueya replied on at Permalink Reply
The discussion above seems to be aimed towards an older version of concrete5, the video you linked to is more recent.