Created package - can't find installed package

Permalink
Hello,

I'm trying to create a package which extends the external_form block. It installs without errors, but I can't find the package in the Add Block list, nor can I see it in the External Form dropdown box.

Here's my package controller file:

<?php 
  defined('C5_EXECUTE') or die(_("Access Denied."));
  class AbContactFormPackage extends Package {
      protected $pkgHandle = 'ab_contact_form';
      protected $appVersionRequired = '5.6.0';
      protected $pkgVersion = '1.0';
      public function getPackageDescription() {
       return t("AB Contact Form");
      }
      public function getPackageName() {
       return t("AB Contact Form");
      }
      public function install() {
       $pkg = parent::install();
       // install block


This is my folder structure:

ab_contact_form/blocks/external_form/forms/controllers/ab_contact_form.php

The main controller class name is AbContactFormExternalFormBlockController

If I simply copy the external_form folder into the blocks folder, everything's working fine, I can find and add my form from the External Form -> AB Contact Form list.

Am I missing anything else?

Thank you.

linuxoid
 
mnakalay replied on at Permalink Reply
mnakalay
I am not 100% sure but I think that when you have
BlockType::installBlockTypeFromPackage('ab_contact_form', $pkg);


it expects to see a folder structure like:
ab_contact_form/blocks/ab_contact_form
linuxoid replied on at Permalink Reply
linuxoid
I've also tried with ab_contact_form/blocks/ab_contact_form/controllers/contact_form.php and class ContactFormAbContactFormBlockController - also installs but can't find it in blocks list.
linuxoid replied on at Permalink Reply
linuxoid
If I change the ab_contact_form.php to view.php and controllers/ab_contact_form.php to controller.php and leave them all in same blocks/ab_contact_form/ folder - then I can see my block in the list (although it doesn't show up properly in the list, looks like it's out of space or something, I mean the row runs half way across it's description in the blocks list if you know what I mean) and I can install it. Maybe this is the way?

But I also need to override the concrete/models/system/captcha/types/securimage/controller.php for my form. If I was doing it by hand myself, I'd copy the file into the main models folder and changed it there. But how can I do that during installation so that both the blocks and models folders get installed? I have to override the concrete's securimage controller.

Thank you.
linuxoid replied on at Permalink Reply
linuxoid
Could anyone help? Thank you.
linuxoid replied on at Permalink Reply
linuxoid
Anyone please?
JohntheFish replied on at Permalink Reply
JohntheFish
This sort of thing is nearly always a minor mistake in the naming conventions. If they do not follow the convention exactly in the code and file names across the package, the block, the db.xml, then all sorts of spurious issues crop up.

Without posting the entire package, it will be impossible for anyone else to check all of that. So you just need to check it all again in fine detail until you spot the misplaced capital or underscore..