Currently all choices (tabs, blocks, accordion) are hardcoded. Introducing a plugin architecture would allow us provide our own variations and would likely streamline the module code.

I can see two ways to get this done:

  1. Provide a hook for modules to provide a list of identifiers, labels and theme/render callbacks.
  2. Rely on ctools to handle plugins. While this adds a new dependency (ctools), imo it would allow for a much cleaner file/code structure.

I'm in favor of option 2, but I'll be happy to provide a patch for either one. Thoughts?

Comments

ciss’s picture

chi’s picture

Component: Code » Documentation

Provide a hook for modules to provide a list of identifiers, labels and theme/render callbacks.

I think it's possible to alter those widgets without providing extra hooks. I suppose we should create an example.

Rely on ctools to handle plugins. While this adds a new dependency (ctools), imo it would allow for a much cleaner file/code structure.

I believe we don't need implement ctools plugins for such a small module.

chi’s picture

Status: Active » Needs work
ciss’s picture

I think it's possible to alter those widgets without providing extra hooks. I suppose we should create an example.

Nope, not to the extend that's required for our current project. One of the hardest parts is the Javascript that makes a lot of assumptions.
The main point I'm trying to make is that it shouldn't be neccessary to alter the existing widgets. Instead one should be able to provide custom widgets with their own CSS and Javascript.

I believe we don't need implement ctools plugins for such a small module.

I've already begun to implement plugin support and restructure the existing widgets into plugins. I'm currently using ctools, but I guess it shouldn't be a problem to change that into a simple plugin hook.

chi’s picture

Component: Documentation » Code
Assigned: Unassigned » ciss

At the moment I don't have enough time for this project. Feel free to commit any changes if you have strong vision of how it should work.
https://www.drupal.org/node/2312279#comment-9011313

ciss’s picture

Just a heads up: I've rewritten large parts of mvw based on 7.x-1.x and will be pushing the changes to 7.x-3.x at the start of next week if there are no objections.
The most important changes are:

  • Generic support for different field structures (like scald, entity_reference, field_collection etc). Also, no more hook_theme_registry_alter().
  • Plugin architecture (via single hook, no ctools required). Tabs, blocks and accordeon are now plugins, extending from a base plugin object.
ciss’s picture

Pushed to 7.x-1.x-plugins.