Download & Extend

Start quiz button is not implemented in the hook_field_extra_fields

Project:Quiz
Version:7.x-4.0-alpha12
Component:Code - Quiz core
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

The "Start quiz" button that gets attached to the quiz node in hook_view should be implemented in hook_field_extra_fields so that Drupal core and other modules know about it.

I found this problem when I was using this module with Display Suite (http://drupal.org/project/ds) and the "Start quiz" button wouldn't show up in the Manage Display tab in the back-end and wouldn't be rendered in the front-end.

Here is my suggestion to fix the problem:

<?php
/**
* Implements hook_field_extra_fields().
*/
function quiz_field_extra_fields() {
 
$extra = array();

 
$extra['node']['quiz'] = array(
   
'display' => array(
     
'take' => array(
       
'label' => t('Take quiz button'),
       
'description' => t('The take button.'),
       
'weight' => 10,
      ),
    ),
  );

  return
$extra;
}
?>

Comments

#1

I'm having a similar problem. Had everything working fine and I can't figure out what is causing the problem. I've disabled any new modules, changed themes, etc. but cant' get the button to appear for users.

Where do I add this code? I've tried a couple places so I'm either putting in the wrong place or and up against a different problem.

Thanks!

----

Ignore this...problem with my theme.

#2

Status:active» fixed

Thanks for the fix. Added start quiz button and quiz summary to hook_field_extra_fields(). Commit c1842a0..e5e51e3.

#3

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here