EE4 Add-on Fieldtype Bug

November 28, 2017 12:00pm

Subscribe [2]
  • #1 / Nov 28, 2017 12:00pm


    8 posts

    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.

  • #2 / Nov 28, 2017 12:19pm

    Seth Barber's avatar

    Seth Barber

    172 posts

    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',
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases