I cloned your module "Model".
Replaced "model" with "cfd" in all file names.
Replaced all instances of "Model" or "model" with "Cfd" or "cfd" within the code.
Enabled the module (now called "Cfd")
Tested "CfdTypes": Worked: Can add types and view the CfdTypes view.
Tested Cfd: Cannot view the "Cfd" view. Can add new Cfd's, but the view is not showing when finished adding.

Nothing else was changed or added.

I'm doing something wrong?

Regards.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

stevesmename’s picture

Category: bug » support

Marking this as a support request.

If your attempting to build a custom module, using model project as a base starter - you may want to zip and post your module as an attachment for someone to fully review what is happening with your custom alterations.

stevesmename’s picture

FileSize
11.24 KB

Just for the record: I'm having the same problem. It worked for one custom module I created based on Model but I'm having the problem finding why this is occurring with the second module I've built.

A better title for this issue might be:
"The default view is not imported on module activation"

When I import the $view by hand in the UI everything is fine. Any idea what hook/file/function is missing? I've attached my custom module as I suggested in a previous comment but in reality I just simply did the same steps as mentioned by the original post (replaced "Model" & "model" with "Client" & "client").

This is on a standard Drupal 7 core install with only required contrib modules enabled.

stevesmename’s picture

Title: "Model" view cannot be viewed » "Model" view not imported when multiple Models enabled
Category: support » bug

I think this issue occurs whenever there are two model projects installed simultaneously.

I created and installed a fully working custom module; this custom module is based on the Model module. When I then install the "model" module (as-is on project page) afterwards it seems this issue occurs for the second model module that was enabled but this does not occur for the first Model module that was enabled.

@jmariani - Did you have two "model" projects installed simultaneously when you reach this error? Does your custom "cfd" module work if there are no other model modules installed?

I'm switching this back as a bug report as I believe this is something that needs investigated by the maintainers of the Model project. Also updating Title appropriately.

DrMiaow’s picture

This stung me as well.

The issue is with line 213 of model/views/model.views.inc

  $views[] = $view;
  return $views;

should be

  $views['my_model_name'] = $view;
  return $views;

The root cause is that model_views_default_views (which implements hook_views_default_views) when it populates the response using $views[] = $view, the most recent one to execute, is clobbering the previous one.

Giving each one its own id in the return array, solves the issue for me.

Many Bothans died for this information.

Daniel_KM’s picture

Hi,

Here is the patch for that (but use $views[$view->name] = $view;). This is a duplicate of #1277016: views bug.. The patch allows you to have more than one module based on Model simultaneously.

Sincerely,

Daniel Berthereau
Infodoc & Knowledge management

DrMiaow’s picture

Thanks. Yep I ended up doing a similar $views[$view->name] = $view; in my code.

shushu’s picture

Priority: Normal » Major

Being a kick-starter module, the ability to customize and duplicate is critical.
Well, maybe not critical, but major...
Just wasted a long day on this issue.
Please fix it for future users...

roeneman’s picture

Hi, I still run into this issue reported almost two years ago and found the same by debugging ...
Hopefully maintainers can put this patch in ... please? It say's this module is still under maintenance....
Also renaming model.views.inc to model.views_default.inc as suggested above and in the api docs.
Thanks,

Roeneman

ronald_istos’s picture

Issue summary: View changes
Status: Active » Fixed

Fixed commited

Status: Fixed » Closed (fixed)

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