Closed (fixed)
Project:
Custom Formatters
Version:
7.x-2.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
10 Jun 2011 at 16:35 UTC
Updated:
4 Jan 2014 at 00:53 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
mrfelton commentedI'm getting this error all the time. I haven't exported any f my custom formats.
Comment #2
mbopp commentedSo I believe this may not be related to the export as I originally thought. I traced the problem up to the calling function in ctools_export_ui.class.php on line 46.
function load_item($item_name)
The object instance doesn't seem to have a schema to pass this function.
Comment #3
mbopp commentedOkay, found the issue. CTools requires the export_ui include file to define itself using the $plugin variable or a specified function. This module is using the $plugin variable which is included using 'include_once'. The problem is that it is already included once by the 'custom_formatters' module and thus isn't being included again. Because of this the $plugin variable isn't redefined to the appropriate value... it is just NULL.
It seemed the easiest way around this was to just use the other option for defining a plugin. Defining a function.
I added the function custom_formatters_custom_formatters_ctools_export_ui() to replace the $plugin variable. It returns the same information, but doesn't conflict with running 'require once' more than once.
The patch should work for either the beta or dev version (and maybe others).
Hope this helps.
Comment #4
decipheredmbopp,
Can you reference any documentation suggesting this method for CTools plugins? I would prefer to only follow supported approaches.
Also, could either of you provide some more steps on how you are reproducing this error? I have yet to come across it and I assure you I am putting the module through rigorous testing. I don't doubt that the error is occurring, I just prefer to be able to see an error before committing code to fix it.
Cheers,
Deciphered.
PS, Dropping this back to major as I can neither reproduce it nor is this a stable release.
Comment #5
mbopp commentedSure, I found this option out via the code comments as I was tracing the error within the function ctools_plugin_load_includes() in ctools/includes/plugins.inc. Copied below...
So as far as replication goes, I created a custom formatter for use within a view that displays a date range based on a multiple date field. I received the error whenever the view was displayed.
So the problem, as I may have mentioned, is related to the $plugin variable. Setting this variable is only an option if the file is never referenced via "include_once" (with the exception of the ctools_plugin_load_includes function). Because include once won't interpret the code again if the file has already been included, the $plugin variable isn't reset, and because the $plugin variable is nullified right before including this file for the second time the $plugin variable remains null. This ultimately results in ctools throwing the error "Notice: Undefined index: export in ctools_export_crud_load() (line 75 of sites/all/modules/ctools/includes/export.inc)."
Oddly this doesn't seem to prevent the functionality from working correctly. The custom formatter works as designed even when the error is thrown.
Hope this helps. Let me know if there is anything else I can do. Thanks for contributing and maintaining this great module Deciphered!
Comment #6
decipheredHi mbopp,
I had some time to look into this issue, and I was unable to reproduce the issue with either PHP 5.2.x or 5.3.x.
Could you possibly provide me with a Feature and Drush make file, or access to a site where this is 100% reproducible?
Cheers,
Deciphered.
Comment #7
kelvinwong commentedSame problem here. Using PHP 5.2.9
Comment #8
annikaC commentedMe too. Using PHP 5.3.6.
The functionality still works, I just get the error on every page that uses the view with custom formatters in.
Comment #9
annikaC commentedAnd mbopp, if I use your patch, error goes away, but I have a big ol' "Edit formatter" string turning up in my formatter outputs... and 2 Formatters dashboard menu entries. :)
Comment #10
yareckon commentedSame error here.
My custom formatter code is:
Would be great to get an "official" patch that avoids this. :)
Comment #11
hdcwebteam commentedSame issue here. I'm using Panels and displaying a node's file field with a simple custom formatter - it works fine but I get the notice as described above.
Comment #12
decipheredAs I have still not been provided with any information on how to reproduce this issue, and as all searches point to this error being a fixable by Clearing Cache, etc, I have no option but to mark this as closed for the moment.
If someone can provide me with details on reproduction, or any other useful information I would be more than happy to reopen.
Cheers,
Deciphered.
Comment #13
decipheredI have reproduce this issue a couple of times, but it's still tricky to nail down exactly how.
Given the multiple reports of this issue I have decided to commit the patch and with any luck it will resolve the issue once and for all.
Thanks mbopp.
Comment #14
odegard commentedI just wanted to confirm that this patch fixes the issue. My use case is as follows:
I'm using page manager to show a long-text field in a panel. Don't know if that is important or not. I wanted to show it in a two column fashion so I imported the code from your post here:
http://drupal.org/node/46415#comment-4603910
I installed the module. Imported the code as given, changed $column to 2, went to page manager and set the formatter to the name I gave the imported code. Flushing the cashe and only then, did I get the message in OP.