We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

#EE3: Template::fetch_addons() doesn't fetch 3rd party module classes

Developer Preview

Mark Croxton's avatar
Mark Croxton
319 posts
10 years ago
Mark Croxton's avatar Mark Croxton

Congrats on the preview, good work!

I just tried installing a third party add-on which exposes template tags (in mod.my_addon.php), but they don’t work in templates because third party add-ons are not recognised by the template class.

       
NicoDG's avatar
NicoDG
26 posts
10 years ago
NicoDG's avatar NicoDG

On line 2899 of Template.php $info->getPath() of third party addons just returns the relative path in the addons folder. That’s the reason why module files can’t be found

       
Seth Barber's avatar
Seth Barber
172 posts
10 years ago
Seth Barber's avatar Seth Barber

Well that’s an embarrassing bug; mea culpa. I have this fixed for the next build, in the meantime replace fetch_addons() with the following:

public function fetch_addons()
 {
  $providers = ee('App')->getProviders();

  foreach (array_keys($providers) as $name)
  {
   try
   {
    $info = ee('App')->get($name);
    if (file_exists($info->getPath() . '/mod.' . $name . '.php'))
    {
     $this->modules[] = $name;
    }
   }
   catch (\Exception $e)
   {
    continue;
   }
  }

  // Fetch a list of installed plugins
  $plugins = ee('Model')->get('Plugin')->all();

  if ($plugins->count() > 0)
  {
   $this->plugins = $plugins->pluck('plugin_package');
  }
 }
       
Mark Croxton's avatar
Mark Croxton
319 posts
10 years ago
Mark Croxton's avatar Mark Croxton

That works great, thanks!

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.