This forum is for module development and code related questions, not general module support. For general support, use the post installation forum.

THIS FORUM IS NOT FOR "What module..." or module support questions-- it's for module development and code related questions.

The module development and code questions forum is intended to aid those who are developing modules or writing code for Drupal.

Please note that this forum is also not intended for "Is there a module that does..." or "I need help with module x..." questions. It's also not a place to ask developers to write your code for you. Please respect this.

Please do not post general discussions intended to target module developers. If the question you have isn't specifically related to writing a drupal module, please post it in a more appropriate forum.

  • If you you have drupal installed already and are seeking a module that does a specific task, have a question about a specific module and what it does or if it will fit your use case, please place your questions in the Post installation forum.
  • If you have a problem or question about a specific module, you should create an issue in the module's issue queue (after checking for an existing issue first).
  • If you don't have drupal installed yet, please place your questions in the Before you start forum.

if else statement

Perhaps a very simple question for some :)

I would like to know how to write an if / else statement with the following.

What i basically want is to have a 'read more' appear only when the href is filled in, and if not, the entire line is not shown.

Capture vid, or referrer_uri

My simple issueTracker custom module should be able to capture the node id, or at least the referring url so we know what page the user was on. Turning on the dev module I can see that the vid property would do nicely to capture as a hidden value. Reading on the docs I see how I can set the global to $user which I can capture the uid from that object. In my searches, I don't see an equivalent to capture this object.

Are Entities an appropriate solution for my problem?

Hey all, not a very active member of this community, but have been developing in Drupal for several years. I'm currently working on a portfolio site for my work. I originally created a field type that handled images, adding title, description, and anchor point data as well as the ability to responsively load images. That field was then added to a Project content type. Originally, the template for the Project content type would programmatically figure out where to place images alongside text content.

count(*) with GROUP BY Clause in db_select

Hello Everyone,

I need a way to find out number of records which are repeated after grouping two columns [Also, these two columns are coming from two different tables]. I can execute it using db_query but not sure what I am missing when using db_select.

Query executed in db_query:
SELECT count(*) as count,n.`nid`,u.`name` FROM `node_view_count` n LEFT JOIN `users` u ON n.`uid` = u.`uid` WHERE n.`uid` <> 0 GROUP BY n.`nid`,u.`name`;

Above query is returning me number of repeated records as well who have uid and nid same.

Submit after custom function

Hello Everyone,

I have the following code that creates a button that runs a custom function. After the function is run, I want to continue with the submit and create the node. How do I do that?



$form['set_new_defaults'] = array(
'#type' => 'submit',
'#value' => t('Set New Default'),
'#submit' => array('policy_general_policy_write'),

function policy_general_policy_write($form, &$form_state){


Subscribe with RSS Subscribe to RSS - Module Development and Code Questions