1

Model Entities: http://drupal.org/project/model

I've been trying to use this contrib module to create my own entity (the "client" entity). Steps I've undertaken:

  1. Search and replaced "model" with "client", "Model" with "Client".
  2. Upon enabling the module, the "client type" appears in "admin/structure", and I create a "client type" from the UI.
  3. Go to "admin/content/clients" and added a new client, but the new "client" entity does not appear.

So far debugging has gotten me this far:

  1. The database is being populated correctly - so the creating functions (and rest of CRUD - tested via direct calling) is working.
  2. I checked entity_load('client') and it's loading the client entities properly as well.

So I suspected it's something to do with the custom "views" that the module is implementing. And indeed, it did not register the custom view properly since it did not appear in "admin/structure/views".

I can't seem to pin-point the error here. Any idea why the view isn't registering?

1
  • Update: The "Model Entities" module works fine out of the box. And I'm able to create "model" entities, and view them in "admin/content/models".
    – Andrew G.
    Commented Aug 20, 2012 at 18:41

1 Answer 1

2

I know this question is a little old, but just in case you (or others) still need assistance... Make sure the hook_views_default_views() was renamed properly. If your module name is "client" then it should be client_views_default_views().

I was recently working with the Model Entities module and ran into the same issue. Turns out I missed renaming that function.

If it's named correctly, then I suggest comparing your file to the model.views.inc file to find the difference.

3
  • How did you managed to get this working? I tried to replace "model" and "Model" with my own module name but it doesn't work, the module doesn't want to install
    – gregab
    Commented Jul 30, 2013 at 5:59
  • Here's what I did: 1. Copy and rename the model module folder.
    – apower
    Commented Aug 15, 2013 at 15:59
  • ...sorry, hit enter too soon :) Here's what I did: 1. Copied and renamed the model module folder with my new module name, "client" for example. 2. Renamed all .module, .inc, and .php files to use "client" instead of "model" in the filename (don't forget the files in the views folder) 3. Went into each file and replaced all instances of "model" with "client" (maintaining case) 4. Compared the new "client" module with the model module to see if there were any differences. 5. Enabled the module and cleared cache (just to be safe).
    – apower
    Commented Aug 15, 2013 at 16:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.