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

EE4 Add-on Fieldtype Bug

Developer Preview

Jace Richardson's avatar
Jace Richardson
13 posts
7 years ago
Jace Richardson's avatar Jace Richardson

In a fieldtype file, in the display_field() method, if you return a call to EE’s view loader like so: return ee()->load->view('my_addon_view', ...);

It only works if caching is turned on (even if you delete the contents of the /system/user/cache) but if caching is disabled, you get Unable to load the requested file: my_addon_view.php.

We added a var_dump of $this->_ci_view_paths in the /system/ee/legacy/core/Loader.php _ci_load() method right before the show_error()conditional and when caching is enabled, our add-on is listed in the view paths; when caching is disabled, it is not listed.

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

Try returning an ee('View') object instead. The code will look something like:

return ee('View')->make('my_addon:my_addon_view')->render([
    'var1' => 'foo',
    'var2' => 'bar',
]);
       

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.