Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#5 | model-Fixed_view_name-1277016-2.patch | 685 bytes | Daniel_KM |
#2 | client-7.x-1.x-dev.tar_.gz | 11.24 KB | stevesmename |
Comments
Comment #1
stevesmename CreditAttribution: stevesmename commentedMarking 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.
Comment #2
stevesmename CreditAttribution: stevesmename commentedJust 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.
Comment #3
stevesmename CreditAttribution: stevesmename commentedI 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.
Comment #4
DrMiaow CreditAttribution: DrMiaow commentedThis stung me as well.
The issue is with line 213 of model/views/model.views.inc
should be
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.
Comment #5
Daniel_KM CreditAttribution: Daniel_KM commentedHi,
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
Comment #6
DrMiaow CreditAttribution: DrMiaow commentedThanks. Yep I ended up doing a similar
$views[$view->name] = $view;
in my code.Comment #7
shushu CreditAttribution: shushu commentedBeing 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...
Comment #8
roeneman CreditAttribution: roeneman commentedHi, 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
Comment #9
ronald_istos CreditAttribution: ronald_istos commentedFixed commited