new modules: with or without new node type?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

new modules: with or without new node type?

Alex Rice
Hi all, In this tutorial
http://gmod.org/wiki/Tripal_Developer%27s_Handbook#The_Anatomy_of_a_Tripal_Module

You say: "Add a New Node Type: In some cases we want to create a new
content type. We specify a new content type anytime we need to create
special pages to hold content."

Question: It's implied by the statement above, that sometimes it might
not be necessary to add a new node type. I don't necessarily want to
implement a dozen drupal hook functions, to create a new node content
type, if there is an easier way. For example in my case, if all the data
to be presented to the user is already existing in the chado database?
Isn't there a way to just query that data directly, or through some
object relational layer in PHP, or is it in practice usually necessary
to create a new drupal content type?

I am probably overlooking something obvious and will be reading through
the drupal module developer docs for what the appropriate hook functions
might be relevant.

--
Alex Rice <[hidden email]>
Software Engineer
National Center for Genome Resources (NCGR)
http://ncgr.org
(505)995-4457

------------------------------------------------------------------------------
WatchGuard Dimension instantly turns raw network data into actionable
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
_______________________________________________
Gmod-tripal mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-tripal
Reply | Threaded
Open this post in threaded view
|

Re: new modules: with or without new node type?

Lacey-Anne Sanderson-3
Hi Alex,
The rule-of-thumb is that if you want a page per record for many of the records in your Chado table of interest then you should create a node type for it. This provides a lot more flexibility for theming and adding non-chado fields using the Drupal Field UI. There are really only 6 hooks you need to implement to create a Drupal hook.

Now, as to alternatives :) You can use Drupal Vies to create listings (tables, grids, html lists, etc. of all data in chado. Furthermore, you can then restrict a view to show only a single record based on an argument in the path effectively creating dynamic pages for Chado content. You can even theme these views to make them look more like a page and less like a list of fields. However, this only gives you viewing capabilities whereas a node will give you edit/delete.

Is your reason to not make a node type just not wanting to wade through Drupal API to determine how to implement it? There isn't really any more overhead performance wise as compared to the view method. I personally think it is easier to maintain nodes (I've done both ways). The only duplicated data is the primary key of your Chado data. Two records are created in Drupal, one for the node & one to link the node and Chado content.

One situation where a dynamic view page might be better than a node is if you have a Very large number of records that will be viewed infrequently and only have 1-3 fields with little content.

It's really a judgement call that could go either way & depends entirely on your data & even personal preference... What type of Chado content are you trying to represent & what is your use case?

Hope that was clear & helpful!
~Lacey

> On Jan 28, 2014, at 5:25 PM, Alex Rice <[hidden email]> wrote:
>
> Hi all, In this tutorial
> http://gmod.org/wiki/Tripal_Developer%27s_Handbook#The_Anatomy_of_a_Tripal_Module
>
> You say: "Add a New Node Type: In some cases we want to create a new
> content type. We specify a new content type anytime we need to create
> special pages to hold content."
>
> Question: It's implied by the statement above, that sometimes it might
> not be necessary to add a new node type. I don't necessarily want to
> implement a dozen drupal hook functions, to create a new node content
> type, if there is an easier way. For example in my case, if all the data
> to be presented to the user is already existing in the chado database?
> Isn't there a way to just query that data directly, or through some
> object relational layer in PHP, or is it in practice usually necessary
> to create a new drupal content type?
>
> I am probably overlooking something obvious and will be reading through
> the drupal module developer docs for what the appropriate hook functions
> might be relevant.
>
> --
> Alex Rice <[hidden email]>
> Software Engineer
> National Center for Genome Resources (NCGR)
> http://ncgr.org
> (505)995-4457
>
> ------------------------------------------------------------------------------
> WatchGuard Dimension instantly turns raw network data into actionable
> security intelligence. It gives you real-time visual feedback on key
> security issues and trends.  Skip the complicated setup - simply import
> a virtual appliance and go from zero to informed in seconds.
> http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
> _______________________________________________
> Gmod-tripal mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gmod-tripal

------------------------------------------------------------------------------
WatchGuard Dimension instantly turns raw network data into actionable
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
_______________________________________________
Gmod-tripal mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-tripal
Reply | Threaded
Open this post in threaded view
|

Re: new modules: with or without new node type?

Stephen Ficklin-2
Hi Alex,

To add a bit more to Lacey's comments.   If I remember correctly, you
are working on the tables in the phylogeny module of Chado and you said
that your module will not be general purpose.   As this is your module,
you are free to program it however you want, with or without defining a
node type.

I concur with Lacey that defining a node type is a good rule of thumb
because it plugs you into the Drupal functionality (additional ones
include setting user/group permissions on nodes (pages), commenting on
nodes, setting Drupal taxonomy (keywords) on  nodes, using Drupal
default search, etc.). Those things allow other users of your module to
have the full freedom of functionality that Drupal provides for the
content provided by the module.  But, as your module is not general
purpose it's your call.

We do not have a general purpose phylogeny module for Tripal at the
moment.  But if we were implementing one I would probably expect that we
would define at least a phylotree node type... and possibly a phylonode
node type (not entirely sure if we would need a phylonode node type).  
It would be great to have a general purpose phylogeny module for Tripal,
if you would be willing to discuss the potential for making your module
general-purpose we would be happy to chat more about it with you,
provide some design requirements, and if in the end it seems like
something that could be added to Tripal itself (rather than shared as an
extension module or kept private) we could potentially provide some
coding assistance.  Just let us know on the developers mailing list at
https://lists.sourceforge.net/lists/listinfo/gmod-tripal-devel.

One thing to consider as well is that we are are soon to release a
Drupal 7 compatible verion of Tripal which if you want to move to D7
you'll have to upgrade your module.  If you do decide to implement node
types it may be a lot easier to implement those after your D7 upgrade to
save you time on the upgrade.

Stephen

On 1/28/2014 10:34 PM, Lacey Sanderson wrote:

> Hi Alex,
> The rule-of-thumb is that if you want a page per record for many of the records in your Chado table of interest then you should create a node type for it. This provides a lot more flexibility for theming and adding non-chado fields using the Drupal Field UI. There are really only 6 hooks you need to implement to create a Drupal hook.
>
> Now, as to alternatives :) You can use Drupal Vies to create listings (tables, grids, html lists, etc. of all data in chado. Furthermore, you can then restrict a view to show only a single record based on an argument in the path effectively creating dynamic pages for Chado content. You can even theme these views to make them look more like a page and less like a list of fields. However, this only gives you viewing capabilities whereas a node will give you edit/delete.
>
> Is your reason to not make a node type just not wanting to wade through Drupal API to determine how to implement it? There isn't really any more overhead performance wise as compared to the view method. I personally think it is easier to maintain nodes (I've done both ways). The only duplicated data is the primary key of your Chado data. Two records are created in Drupal, one for the node & one to link the node and Chado content.
>
> One situation where a dynamic view page might be better than a node is if you have a Very large number of records that will be viewed infrequently and only have 1-3 fields with little content.
>
> It's really a judgement call that could go either way & depends entirely on your data & even personal preference... What type of Chado content are you trying to represent & what is your use case?
>
> Hope that was clear & helpful!
> ~Lacey
>
>> On Jan 28, 2014, at 5:25 PM, Alex Rice <[hidden email]> wrote:
>>
>> Hi all, In this tutorial
>> http://gmod.org/wiki/Tripal_Developer%27s_Handbook#The_Anatomy_of_a_Tripal_Module
>>
>> You say: "Add a New Node Type: In some cases we want to create a new
>> content type. We specify a new content type anytime we need to create
>> special pages to hold content."
>>
>> Question: It's implied by the statement above, that sometimes it might
>> not be necessary to add a new node type. I don't necessarily want to
>> implement a dozen drupal hook functions, to create a new node content
>> type, if there is an easier way. For example in my case, if all the data
>> to be presented to the user is already existing in the chado database?
>> Isn't there a way to just query that data directly, or through some
>> object relational layer in PHP, or is it in practice usually necessary
>> to create a new drupal content type?
>>
>> I am probably overlooking something obvious and will be reading through
>> the drupal module developer docs for what the appropriate hook functions
>> might be relevant.
>>
>> --
>> Alex Rice <[hidden email]>
>> Software Engineer
>> National Center for Genome Resources (NCGR)
>> http://ncgr.org
>> (505)995-4457
>>
>> ------------------------------------------------------------------------------
>> WatchGuard Dimension instantly turns raw network data into actionable
>> security intelligence. It gives you real-time visual feedback on key
>> security issues and trends.  Skip the complicated setup - simply import
>> a virtual appliance and go from zero to informed in seconds.
>> http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Gmod-tripal mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/gmod-tripal
> ------------------------------------------------------------------------------
> WatchGuard Dimension instantly turns raw network data into actionable
> security intelligence. It gives you real-time visual feedback on key
> security issues and trends.  Skip the complicated setup - simply import
> a virtual appliance and go from zero to informed in seconds.
> http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
> _______________________________________________
> Gmod-tripal mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gmod-tripal


------------------------------------------------------------------------------
WatchGuard Dimension instantly turns raw network data into actionable
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
_______________________________________________
Gmod-tripal mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-tripal