Deleting a custom layout in a site's theme layout directory, even if the layout is not in use by any panel, produces the following error:-

Fatal error: require_once(): Failed opening required '/sites/all/themes/bootstrap_xxx/layouts/example/example.inc' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /sites/all/modules/ctools/includes/plugins.inc on line 475

This means keeping the layouts even if they're not is use. How can a layout be removed?

Comments

hfarrier’s picture

Same here - using latest Panopoly distro 1.20. Steps to reproduce.

  1. Create layout directory in theme directory
  2. Update theme .info file to tell panels where the custom layout directory is located (i.e. plugins[panels][layouts] = layouts)
  3. Create custom layout with .inc .tpl and .png and transfer within layout directory
  4. Ctools recognizes the new layout
  5. Delete custom layout folder
  6. Fatal error results due to missing layout files ctools/includes/plugins.inc on line 475

I also tried to remove plugins[panels][layouts] = layouts from theme .info file without luck. Fatal error persists. The only way to pull site back up again is to transfer the layout files back to the server.

How do you properly delete custom panels layouts?

aleksijohansson’s picture

How do you properly delete custom panels layouts?

Wondering the same thing here! Tried clearing caches and even searching the database for references, but didn't find any.

goldin’s picture

Yes, you should be able to delete or even rename custom Panels layouts. It appears updating to CTools 7.x-1.6 causes the error.

I recently created/edited/renamed several custom layouts on a site (let's call Site A) with no problem. I copied one of those layouts to Site B and ran into above error when I then tried to edit the layout name.

Site A is running Panels 7.x-3.3 and CTools 7.x-1.4. Site B is running Panels 7.x-3.5 and CTools 7.x-1.6.

I tested locally by updating Site A to CTools 7.x-1.5 and then 7.x-1.6. On each pass I deleted a custom layout. The site threw the error with 7.x-1.6. I also reverted Site B to Panels 7.x-3.4 and CTools 7.x-1.5 and the error disappeared when I deleted or renamed a layout.

jenlampton’s picture

This looks like it is the same problem as #2207147: Fatal error: require_once() panel_context.inc

jenlampton’s picture

pvasili’s picture

1) Try start SQL:
delete from cache where cid like 'ctools_plugin%';
2) Delete unnecessary styles and layouts folder.
3) F5

All unnecessary styles and layouts deleted

Rick Hood’s picture

Just ran into this also. Thanks @pvasili - #6 worked for me.

Dubs’s picture

Thanks @pvasili #6 - works for me too :-)

goldin’s picture

Yep, #6 works for me too. It appears you have to execute the command every time you make new changes to your custom layouts.

Thank you @pvasili.

jennypanighetti’s picture

I removed my layout and had the same error. This sequence of commands helped me:

drush rr
drush cache-clear all
drush cron

[edit] Never mind, don't do that... I then couldn't access my site, even on local, it just said "waiting for site.local....." for forever..... I had to download a backup (which didn't have my theme in it) to restore the site.

So, if anybody has any better ideas....? :-/

sch2’s picture

#6 worked nicely, although it's a really hacky solution for something that should be prevented by the module itself.

museumboy’s picture

This was my fix.

1. Replace layout folders as needed to get the site working and flush the cache.
2. Comment out the layout call in your theme .info file like this: ;plugins[panels][layouts] = layouts
3. Return to site and flush cache. Anything in a layout should be missing after flush.
4. Delete offending layout folders
5. Flush cache, you should still see no errors or warnings.
6. Uncomment layout call in .info file
7. Flush cache again.

Site should be good after that. Maybe I didn't need flush cache in step 5, but I like to check my work along the way. This worked for me.

codemonkie’s picture

So, if you delete layout files:

- first do a cache clear
- then delete the files

And you will be fine. You get the error when you delete ctools plugin (layout) files that are still referenced in the ctools cache.

gcarlosvp’s picture

#13 worked for me. Thanks!

MikaT’s picture

#6 fixed the issue for me

error was
PHP Fatal error: require_once(): Failed opening required '/srv/project/drupal/docroot/sites/all/modules/contrib/panels/plugins/layouts/xxx.inc' (include_path='.:/usr/share/php:/usr/share/pear') in /srv/project/drupal/docroot/sites/all/modules/contrib/ctools/includes/plugins.inc on line 477

Marvine’s picture

Keep in mind that if your are using memcache to store the content of the cache table you would have to restart the memcache service by doing something like
sudo service memcached restart

webdrips’s picture

This worked for me:

  1. Move or delete layout folder no longer wanted
  2. drush rr
ugintl’s picture

#6 worked for me

Gonzalo2683’s picture

The #12 works for me. Thanks @museumboy