Indicia-Team / drupal-8-module-iform

Drupal 8 modules for Indicia
0 stars 2 forks source link

Resolve missing `helper_base` in `iform_cron()` #15

Closed BezBIS closed 2 months ago

BezBIS commented 2 months ago

This fixes #14. Cron now runs correctly on my local sites.

I have no real experiece of developing with drupal, and the require_once call feels rather 'hacky'. Very open to rewriting these few lines if there's a better way of doing dependency injection here.

johnvanbreda commented 2 months ago

Thanks for the proposed change @BezBIS. I haven't been able to reproduce the problem here, but I have experienced minor updates to Drupal changing the way classes load with similar results in the past.

The way I would suggest making this change is to call iform_load_helpers as follows:

function iform_cron() {
   // Ensure helper_base is loaded.
  iform_load_helpers(['helper_base']);
  ... etc

That includes some other setup code for Indicia correctly. I'm happy for you to update the PR so I can merge it once you've confirmed this works for you, or if you prefer I can commit the change to the develop branch myself. Let me know.

BezBIS commented 2 months ago

Thank you @johnvanbreda. I've added an extra commit to update that as per your suggestion. Tested and working on my local development site.