Closed (fixed)
Project:
Flag
Version:
6.x-2.x-dev
Component:
Flag core
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
31 Jan 2011 at 04:06 UTC
Updated:
23 Feb 2011 at 10:50 UTC
[I originally included this change in the hook_flag_validate() patch. But it has merit on its own, and I want to protect it from a rollback, so I publish it here separately.]
This patch renames flag.tpl.php's $last_action to $status. Why?
- Why use inverse logic when we can use straight one? <... class=flag-$status ...> is easier to understand than <... class=flag-$last_action ...>
- $last_action conveys the impression that an action has been carried out; e.g., that it's only valid in $after_flagging; but it's not so, and furthermore, with the hook_flag_validate() feature an action may be canceled.
- Users use $last_action, although they don't have to, and create strange looking code.
| Comment | File | Size | Author |
|---|---|---|---|
| rename-last-action.diff | 2.6 KB | mooffie |
Comments
Comment #1
mooffie commentedThat's my main problem with "$last_action". When hook_flag_validate() is in place the "$last_action" leaves a question in the reader's mind as to its *exact* meaning. By renaming it to "$status" we clear the doubt.
Comment #2
mooffie commented(The change is backward compatible: at the bottom of template_preprocess_flag() there's a section that retains these deprecated variables.)
Comment #3
mooffie commentedComment #4
mooffie commentedCommitted.
http://drupal.org/cvs?commit=497288
http://drupal.org/cvs?commit=497290