Added token support for: Course, Assignment, and Response node types.
Also added functionality for:
- multiple tokens regarding dates in each of the aforementioned node types (i.e. YY|YYYY|month|mon|mm|m|day|ddd|d|date|value, etc...)
- plaintext token values for boolean fields (e.g. Classroom: Open End Inscription would display "Open Enrollment" or "No" depending on its value, etc...).

I have found this especially useful for adjusting node paths used for my courses via PathAuto (makes aliasing them a BREEZE).

Comments

wjaspers’s picture

StatusFileSize
new10.64 KB

Now to add the file...

wjaspers’s picture

Status: Needs review » Needs work

In response to http://drupal.org/node/972390#comment-3713976 I think I need to make a few adjustments and submit a better patch.

wjaspers’s picture

Status: Needs work » Needs review
StatusFileSize
new13.3 KB

Here's a better patch, which takes advantage of token_get_date_token_info() and token_get_date_token_values() instead of hardcoding our own solution.

dave reid’s picture

Status: Needs review » Needs work
+++ classroom\classroom.module	Tue Nov 16 08:42:05 2010
@@ -531,3 +531,100 @@
+function classroom_token_values($type, &$object = NULL, $options = array()) { ¶
+  if ('node' == $type) {
+    return ¶
+      classroom_course_token_values('all', $object, $options) + ¶
+      classroom_assignment_token_values('all', $object, $options) + ¶
+      classroom_response_token_values('all', $object, $options);
+  }
+  if (_classroom_is_type($type, 'course')) {
+    return classroom_course_token_values('all', $object, $options);
+  }
+  if (_classroom_is_type($type, 'assignment')) {
+    return classroom_assignment_token_values('all', $object, $options);
+  }
+  if (_classroom_is_type($type, 'response')) {
+    return classroom_response_token_values('all', $object, $options);
+  }

You *must* pass on $type to the token_values implementations.

+++ classroom\classroom.module	Tue Nov 16 08:42:05 2010
@@ -531,3 +531,100 @@
+function classroom_token_list($type = 'all') {
+  if ('node' == $type) {
+    return ¶
+      classroom_course_token_list() + ¶
+      classroom_assignment_token_list() + ¶
+      classroom_response_token_list();
+  }
+  if (_classroom_is_type($type, 'course')) {
+    return classroom_course_token_list();
+  }
+  if (_classroom_is_type($type, 'assignment')) {
+    return classroom_assignment_token_list();
+  }
+  if (_classroom_is_type($type, 'response')) {
+    return classroom_response_token_list();
+  }

Use if ($type == 'all' || $type == 'node') { and please pass along the $type parameter. See examples in token module.

Powered by Dreditor.

wjaspers’s picture

Ha; I didn't realize what I'd goofed up. Now I see it. Ill post a fix first thing tomorrow. Thanks much for the feedback.

wjaspers’s picture

Status: Needs work » Needs review
StatusFileSize
new16.8 KB

Third times the charm?

EDIT: I see something that got in there regarding a dev site I was working on.

wjaspers’s picture

imobachgs’s picture

Assigned: Unassigned » imobachgs
Status: Needs review » Active

Commited.

Thanks!

wjaspers’s picture

Status: Active » Fixed

Should have been set to fixed.
Cleaning up my queue.

Status: Fixed » Closed (fixed)

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