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.
Hey,
I was wondering if there is any way to display course object fields to be shown on course outline page. Lets say, I have 5 course content for a particular course. And I want to display a brief description of each course object on course outline page. I create a text field under link - admin/course/object/fields. The field shows for each course object on object-edit page. How can I show this field on course outline page?
Comment | File | Size | Author |
---|---|---|---|
#21 | display_course_object-2277331-21.patch | 7.79 KB | djdevin |
#18 | display_course_object-2277331-18.patch | 7.79 KB | djdevin |
#16 | display_course_object-2277331-14.patch | 7.77 KB | djdevin |
#14 | display_course_object-2277331-14.patch | 7.77 KB | djdevin |
#13 | display_course_object-2277331-13.patch | 7.79 KB | djdevin |
Comments
Comment #1
djdevinIf you go to admin -> course -> objects -> manage fields, you can add a description field which will be shown on all course object configurations.
For now, you would then have to use the same theme functions in #2277331: Display Course Object Fields on Outline Page for them to appear in the list.
In the future there will be a view mode for course objects in the outline, so the theme override will not be necessary.
Comment #2
smits.smiling@gmail.com CreditAttribution: smits.smiling@gmail.com commentedYes, I am trying to use function mythemename_course_outline_item. I can get the course object node title using $object->getTitle(). How do I fetch the new custom field that I created using admin -> course -> objects -> manage fields.
Comment #3
djdevinHi,
Try this
Comment #4
smits.smiling@gmail.com CreditAttribution: smits.smiling@gmail.com commentedThat's awesome. The code worked very well. Thanks for all the help. :)
Comment #5
djdevinUse entity_view for item outlines.
Comment #6
sibopa CreditAttribution: sibopa commentedHi;
Thanks a lot for your great job on this module;
I've applied this path and am having a "undefined index" error on this line:
$co = entity_load_single('course_object', $object->getid());
return drupal_render(entity_view('course_object', array($co)));
Also, I think it will be more efficient to use a field on the content type used as course object instead of the entity?
for example, use the body field of the content type since the course creator almost always fill it?
Thanks again.
Comment #7
djdevinThis patch is old so it may need some more testing.
This is for per-course object fields - when you want different values for a field for each course object, like an "estimated time to complete" for each step. Or, if you wanted a custom image to appear per object, things like that.
Comment #10
sibopa CreditAttribution: sibopa commentedDo we have a new version of the patch?
Comment #11
sibopa CreditAttribution: sibopa commentedI was able to get field to show up using your post #3 above. Is it possible to achieve something similar with field from the object node instead?
Let's say I have a content type "document" set as a "course content" that has a field "description".
How can I alter this
to display the "description" field teaser in the course outline?
Comment #12
djdevinComment #13
djdevinComment #14
djdevinComment #16
djdevinComment #18
djdevinComment #21
djdevinComment #22
djdevinCommitted.
Course objects use entity view now.