Heya, I got one more. This is way tricky, I was nearly giving up before finding out the reason for this bug. This time, Views integration.

Imagine a field module, e.g. filefield, defining any given Views handler inside a file called filefield.views.inc, extending standard CCK behaviour.
The result of this bug is that I when I try to define a class that extends CCK's standard views_handler_field_content_multiple class, PHP hands me an error that it doesn't know the class. Worse, including content.views.inc *does not help either*. Which means I can't extend any of CCK's predefined handler classes.

Now, the cause. I spiced up my drupal_set_message() calls for maximum readability, placing them inside the global scope of content.views.inc and filefield.views.inc. The debug output speaks for itself:

  • Entering content.views.inc.
  • Including other handlers with views_include_handlers()...
  • Entering filefield.views.inc.
  • Including content.views.inc...
  • ...included content.views.inc.
  • Defining my handler which derives from views_handler_field_content_multiple.
  • Leaving filefield.views.inc.
  • ...included other handlers, on with the rest of content.views.inc.
  • Defining views_handler_field_content_multiple.
  • Leaving content.views.inc.

Pretty painful, isn't it?

It's late at night so I don't come up with a patch today anymore, but I guess the solution would be to selectively include only the Views handler files that you actually need in order to define CCK's handlers.

Comments

yched’s picture

Status: Active » Fixed

I think CCK RC fixes this - please reopen if not :-)

jpetso’s picture

Yup, works now, thanks for fixing this. The ironic thing about it is that it now seems I won't need it, as I got a better idea for getting Views customization without CCK formatter settings (presets, that is). Whenever the CCK team gets around to implement those, I'd be eternally grateful.

yched’s picture

Yep, formatter settings are sorely missing in many areas.
They're not difficult code-wise, but UI-wise. Getting a good UI for this would probably require a UI shift similar to the one from Views 1 to Views 2. There has been thoughts of re-using Views 2 UI concepts (and code) in CCK, but not much more than talk for now, that's a fairly large work.

moshe weitzman’s picture

re: formatter settings UI. perhaps just let the formatter off a full menu callback. so, each formatter instance gets a settings link and admin goes to a formatter served page if it is clicked. forrmatter does all the form handling. just a thought. i too am sceptical that a Views2 style UI is coming anytime soon.

jpetso’s picture

yeah, but then you can select the formatter on the same page where the "Configure" link should be, meaning that formatter selections will get lost if the user doesn't hit "Save" before following the "Configure" link. Would work, but is suboptimal usability-wise. Anyways, this discussion should not occur in this issue... I would guess there is already an issue for that. *searching the issue queue* ping, there it is: #226154: Formatter settings on display fields tab and in Views. yched even used the same rationale that I just came up with :P

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.