a function to return the quiz nid

There is a template file in the quiz/template/quiz-report-form.tpl.php of Quiz module. this is the code:

<?php  /**  * @file  * Themes the question report  *  * Available variables:  * $form - FAPI array  *  * All questions are in form[x] where x is an integer.  * Useful values:  * $form[x]['question'] - the question as a FAPI array(usually a form field of type "markup")  * $form[x]['score'] - the users score on the current question.(FAPI array usually of type "markup" or "textfield")  * $form[x]['max_score'] - the max score for the current question.(FAPI array of type "value")  * $form[x]['response'] - the users response, usually a FAPI array of type markup.  * $form[x]['#is_correct'] - If the users response is correct(boolean)  * $form[x]['#is_evaluated'] - If the users response has been evaluated(boolean)  */ // $td_classes = array('quiz-report-odd-td', 'quiz-report-even-td'); // $td_class_i = 0; $p = drupal_get_path('module', 'quiz') .'/theme/'; $q_image = $p. 'question_bg.png'; ?> <h2><?php print t('Question Results');?></h2> <div class="quiz-report"> <?php foreach ($form as $key => $sub_form):   if (!is_numeric($key) || isset($sub_form['#no_report'])) continue;   unset($form[$key]);   $c_class = ($sub_form['#is_evaluated']) ? ($sub_form['#is_correct']) ? 'q-correct' : 'q-wrong' : 'q-waiting';   $skipped = $sub_form['#is_skipped'] ? '<span class="quiz-report-skipped">'. t('(skipped)') .'</span>' : ''?>      <div class="dt">       <div class="quiz-report-score-container <?php print $c_class?>">         <span>           <?php print t('Score')?>         <?php print drupal_render($sub_form['score'])?>         <?php print t('of') .' '. $sub_form['max_score']['#value']?>         <?php print '<br><em>'. $skipped .'</em>'?>       </span>     </div>       <p class="quiz-report-question"><strong><?php print t('Question')?>: </strong></p>       <?php print drupal_render($sub_form['question']);?>     </div>   <div class="dd">     <p><strong><?php print t('Response')?>: </strong></p>     <?php print drupal_render($sub_form['response']); ?>   </div>   <div class="dd">     <?php print drupal_render($sub_form['answer_feedback']); ?>   </div> <?php endforeach; ?> </div> <div class="quiz-score-submit"><?php print drupal_render_children($form);?></div> 

Now I want to change this codes and I need a function to return the nid(number of id) of quiz that the user is seeing. please help me.

This article was republished from its original source.
Call Us: 1(800)730-2416

Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.

FREE Drupal SEO Audit

Test your site below to see which issues need to be fixed. We will fix them and optimize your Drupal site 100% for Google and Bing. (Allow 30-60 seconds to gather data.)

Powered by

a function to return the quiz nid

On-Site Drupal SEO Master Setup

We make sure your site is 100% optimized (and stays that way) for the best SEO results.

With Pixeldust On-site (or On-page) SEO we make changes to your site’s structure and performance to make it easier for search engines to see and understand your site’s content. Search engines use algorithms to rank sites by degrees of relevance. Our on-site optimization ensures your site is configured to provide information in a way that meets Google and Bing standards for optimal indexing.

This service includes:

  • Pathauto install and configuration for SEO-friendly URLs.
  • Meta Tags install and configuration with dynamic tokens for meta titles and descriptions for all content types.
  • Install and fix all issues on the SEO checklist module.
  • Install and configure XML sitemap module and submit sitemaps.
  • Install and configure Google Analytics Module.
  • Install and configure Yoast.
  • Install and configure the Advanced Aggregation module to improve performance by minifying and merging CSS and JS.
  • Install and configure Schema.org Metatag.
  • Configure robots.txt.
  • Google Search Console setup snd configuration.
  • Find & Fix H1 tags.
  • Find and fix duplicate/missing meta descriptions.
  • Find and fix duplicate title tags.
  • Improve title, meta tags, and site descriptions.
  • Optimize images for better search engine optimization. Automate where possible.
  • Find and fix the missing alt and title tag for all images. Automate where possible.
  • The project takes 1 week to complete.