Posted by covenantd on December 14, 2012 at 4:33am
5 followers
Jump to:
| Project: | Quiz |
| Version: | 7.x-4.x-dev |
| Component: | Code - Quiz core |
| Category: | feature request |
| Priority: | normal |
| Assigned: | covenantd |
| Status: | active |
Issue Summary
Found this handy enough to commit back. It is a link like the Views core "Edit link" (based directly off of it actually).
It uses the quiz.module function quiz_take_access($node) to only display the link if the user has permission to access it and the quiz is available.
| Attachment | Size |
|---|---|
| quiz-Add_Take_quiz_link_as_Views_field-000.patch | 2.82 KB |
Comments
#1
Awesome!! Thanks for the patch. Committed to git.
When you share views related patch next time please include a sample views export as well for testing :-)
#2
Great idea with including a views export - will do in the future!
#3
Automatically closed -- issue fixed for 2 weeks with no activity.
#4
Sivaji look like you have forgotten to add to this commit /includes/views/handlers/quiz_views_handler_field_node_link_take.inc handler file.
See commit viewer http://drupalcode.org/project/quiz.git/commitdiff/62ad920 , and also i can not found this file in current 7.x-4.x-dev branch.
#5
I manually created the quiz_views_handler_field_node_link_take.inc file with code in the quiz-Add_Take_quiz_link_as_Views_field-000.patch but I'm getting the following error. Don't have the knowledge to fix it :\
Notice : Undefined index: entity type dans views_handler_field_entity->init() (line 44 in /home/doolysqu/tests/sites/all/modules/views/handlers/views_handler_field_entity.inc).
#6
quiz_views_handler_field_node_link_take extends views_handler_field_node_link and views_handler_field_node_link extends views_handler_field_entity
views_handler_field_entity : 44line
<?php
public function init(&$view, &$options) {
parent::init($view, $options);
// Initialize the entity-type used.
$table_data = views_fetch_data($this->table);
// line 44
$this->entity_type = $table_data['table']['entity type'];
}
?>
Look like your views base table do not have entity_type value. I suppose that you need to add Quiz relationship to your Views, probably.
#7
Seems like no matter what relations I add, it keeps saying this. Tried on the provided views and all to no avail. It would be nice anyway to get a release which would include all the files and the patch applied.
#8
Meh... just realised the default views ain't working either. I created some quizzes and answered them. If I go to the url to show all quizzes taken by a user (quiz by taker), all I get is a "Quizzes taken by admin" and no results displayed. Must be doing something wrong cause when I try to use the "Quiz: Quiz Version" filter critera I get :