Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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:
/**
* 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
Comment #1
leegraves CreditAttribution: leegraves commentedI'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.
Comment #2
Sivaji_Ganesh_Jojodae CreditAttribution: Sivaji_Ganesh_Jojodae commentedThanks for the fix. Added start quiz button and quiz summary to hook_field_extra_fields(). Commit c1842a0..e5e51e3.